diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-26 00:05:29 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-26 00:05:29 +0800 |
commit | 505f1fbcbbc00b3f4750b9e9a7c119f882c620bf (patch) | |
tree | 45b2a6845d6300b4aeea26e3f60b0d5c589fa97e /core/types/transaction.go | |
parent | 65ea55bccd8afb94bed540c89e9ce77acbfa3b31 (diff) | |
download | dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar.gz dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar.bz2 dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar.lz dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar.xz dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.tar.zst dexon-505f1fbcbbc00b3f4750b9e9a7c119f882c620bf.zip |
added tx tests and fixed block tests
Diffstat (limited to 'core/types/transaction.go')
-rw-r--r-- | core/types/transaction.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/types/transaction.go b/core/types/transaction.go index 7aef5ce94..35e8f5ac8 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -79,6 +79,7 @@ func (self *Transaction) From() (common.Address, error) { if len(pubkey) == 0 || pubkey[0] != 4 { return common.Address{}, errors.New("invalid public key") } + var addr common.Address copy(addr[:], crypto.Sha3(pubkey[1:])[12:]) return addr, nil @@ -110,8 +111,9 @@ func (tx *Transaction) PublicKey() []byte { sig := append(r, s...) sig = append(sig, v-27) - //pubkey := crypto.Ecrecover(append(hash, sig...)) - pubkey, _ := secp256k1.RecoverPubkey(hash[:], sig) + //pubkey := crypto.Ecrecover(append(hash[:], sig...)) + //pubkey, _ := secp256k1.RecoverPubkey(hash[:], sig) + pubkey := crypto.FromECDSAPub(crypto.SigToPub(hash[:], sig)) return pubkey } |