diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-02 19:09:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-02 19:09:38 +0800 |
commit | 48d2a8b8ee9621810a988e3561e4213749c54da7 (patch) | |
tree | cbce2a2427287116420e074f4a5ecd8d4f35fbbc /core/types | |
parent | 477a6d426cd798f036df85b15d73935060503a48 (diff) | |
download | go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar.gz go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar.bz2 go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar.lz go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar.xz go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.tar.zst go-tangerine-48d2a8b8ee9621810a988e3561e4213749c54da7.zip |
Refactored tx pool and added extra fields to block
* chain manager sets td on block + td output w/ String
* added tx pool tests for removing/adding/validating
* tx pool now uses a set for txs instead of list.List
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/block.go | 4 | ||||
-rw-r--r-- | core/types/transaction.go | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/core/types/block.go b/core/types/block.go index 7b4695f73..b59044bfc 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -209,7 +209,7 @@ func (self *Block) HashNoNonce() []byte { } func (self *Block) String() string { - return fmt.Sprintf(`BLOCK(%x): Size: %v { + return fmt.Sprintf(`BLOCK(%x): Size: %v TD: %v { Header: [ %v @@ -219,7 +219,7 @@ Transactions: Uncles: %v } -`, self.header.Hash(), self.Size(), self.header, self.transactions, self.uncles) +`, self.header.Hash(), self.Size(), self.Td, self.header, self.transactions, self.uncles) } func (self *Header) String() string { diff --git a/core/types/transaction.go b/core/types/transaction.go index 59244adc3..83d76648f 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -2,6 +2,7 @@ package types import ( "bytes" + "crypto/ecdsa" "fmt" "math/big" @@ -139,6 +140,10 @@ func (tx *Transaction) Sign(privk []byte) error { return nil } +func (tx *Transaction) SignECDSA(key *ecdsa.PrivateKey) error { + return tx.Sign(crypto.FromECDSA(key)) +} + func (tx *Transaction) RlpData() interface{} { data := []interface{}{tx.AccountNonce, tx.Price, tx.GasLimit, tx.Recipient, tx.Amount, tx.Payload} |