aboutsummaryrefslogtreecommitdiffstats
path: root/chain/transaction_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-03 21:05:19 +0800
committerobscuren <geffobscura@gmail.com>2014-12-03 21:05:19 +0800
commit82405501872385b240012070bad2f0eda643d423 (patch)
tree97fcdb3fb3be607d0b21e5da01bbd0f33372ffc2 /chain/transaction_pool.go
parent709eff4ea77b965cdf763ada8ab248e3d850406f (diff)
downloadgo-tangerine-82405501872385b240012070bad2f0eda643d423.tar.gz
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.zst
go-tangerine-82405501872385b240012070bad2f0eda643d423.zip
updated to types
Diffstat (limited to 'chain/transaction_pool.go')
-rw-r--r--chain/transaction_pool.go45
1 files changed, 4 insertions, 41 deletions
diff --git a/chain/transaction_pool.go b/chain/transaction_pool.go
index 15c34cc39..ad89c0a98 100644
--- a/chain/transaction_pool.go
+++ b/chain/transaction_pool.go
@@ -110,7 +110,8 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
return fmt.Errorf("Invalid recipient. len = %d", len(tx.Recipient))
}
- if tx.v > 28 || tx.v < 27 {
+ v, _, _ := tx.Curve()
+ if v > 28 || v < 27 {
return fmt.Errorf("tx.v != (28 || 27)")
}
@@ -142,7 +143,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
func (self *TxPool) Add(tx *types.Transaction) error {
hash := tx.Hash()
- foundTx := FindTx(self.pool, func(tx *Transaction, e *list.Element) bool {
+ foundTx := FindTx(self.pool, func(tx *types.Transaction, e *list.Element) bool {
return bytes.Compare(tx.Hash(), hash) == 0
})
@@ -168,42 +169,6 @@ func (self *TxPool) Add(tx *types.Transaction) error {
return nil
}
-func (pool *TxPool) queueHandler() {
-out:
- for {
- select {
- case tx := <-pool.queueChan:
- hash := tx.Hash()
- foundTx := FindTx(pool.pool, func(tx *types.Transaction, e *list.Element) bool {
- return bytes.Compare(tx.Hash(), hash) == 0
- })
-
- if foundTx != nil {
- break
- }
-
- // Validate the transaction
- err := pool.ValidateTransaction(tx)
- if err != nil {
- txplogger.Debugln("Validating Tx failed", err)
- } else {
- // Call blocking version.
- pool.addTransaction(tx)
-
- tmp := make([]byte, 4)
- copy(tmp, tx.Recipient)
-
- txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tmp, tx.Value, tx.Hash())
-
- // Notify the subscribers
- pool.Ethereum.EventMux().Post(TxPreEvent{tx})
- }
- case <-pool.quit:
- break out
- }
- }
-}
-
func (pool *TxPool) CurrentTransactions() []*types.Transaction {
pool.mutex.Lock()
defer pool.mutex.Unlock()
@@ -261,12 +226,10 @@ func (pool *TxPool) Flush() []*types.Transaction {
}
func (pool *TxPool) Start() {
- go pool.queueHandler()
+ //go pool.queueHandler()
}
func (pool *TxPool) Stop() {
- close(pool.quit)
-
pool.Flush()
txplogger.Infoln("Stopped")