mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
verify signing tx
This commit is contained in:
parent
cd81c5c8b6
commit
381864d869
3 changed files with 32 additions and 14 deletions
|
|
@ -39,6 +39,7 @@ const (
|
||||||
UnvoteMethod = "0x02aa9be2"
|
UnvoteMethod = "0x02aa9be2"
|
||||||
ProposeMethod = "0x01267951"
|
ProposeMethod = "0x01267951"
|
||||||
ResignMethod = "0xae6e43f5"
|
ResignMethod = "0xae6e43f5"
|
||||||
|
SignMethod = "0xe341eaa4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,7 @@ func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, number ui
|
||||||
|
|
||||||
var signTxs []*types.Transaction
|
var signTxs []*types.Transaction
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
|
if tx.IsSigningTransaction() {
|
||||||
var b uint
|
var b uint
|
||||||
for _, r := range receipts {
|
for _, r := range receipts {
|
||||||
if r.TxHash == tx.Hash() {
|
if r.TxHash == tx.Hash() {
|
||||||
|
|
@ -353,6 +354,7 @@ func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, number ui
|
||||||
from := *tx.From()
|
from := *tx.From()
|
||||||
data[blkHash] = append(data[blkHash], from)
|
data[blkHash] = append(data[blkHash], from)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
c.BlockSigners.Add(header.Hash(), signTxs)
|
c.BlockSigners.Add(header.Hash(), signTxs)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,22 @@ func (tx *Transaction) IsSigningTransaction() bool {
|
||||||
if tx.To() == nil {
|
if tx.To() == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return tx.To().String() == common.BlockSigners
|
|
||||||
|
if tx.To().String() != common.BlockSigners {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
method := common.ToHex(tx.Data()[0:4])
|
||||||
|
|
||||||
|
if method != common.SignMethod {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(tx.Data()) != (32*2 + 4) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) IsVotingTransaction() (bool, *common.Address) {
|
func (tx *Transaction) IsVotingTransaction() (bool, *common.Address) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue