mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +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"
|
||||
ProposeMethod = "0x01267951"
|
||||
ResignMethod = "0xae6e43f5"
|
||||
SignMethod = "0xe341eaa4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -336,22 +336,24 @@ func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, number ui
|
|||
|
||||
var signTxs []*types.Transaction
|
||||
for _, tx := range txs {
|
||||
var b uint
|
||||
for _, r := range receipts {
|
||||
if r.TxHash == tx.Hash() {
|
||||
b = r.Status
|
||||
break
|
||||
if tx.IsSigningTransaction() {
|
||||
var b uint
|
||||
for _, r := range receipts {
|
||||
if r.TxHash == tx.Hash() {
|
||||
b = r.Status
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if b == types.ReceiptStatusFailed {
|
||||
continue
|
||||
}
|
||||
if b == types.ReceiptStatusFailed {
|
||||
continue
|
||||
}
|
||||
|
||||
signTxs = append(signTxs, tx)
|
||||
blkHash := common.BytesToHash(tx.Data()[len(tx.Data())-32:])
|
||||
from := *tx.From()
|
||||
data[blkHash] = append(data[blkHash], from)
|
||||
signTxs = append(signTxs, tx)
|
||||
blkHash := common.BytesToHash(tx.Data()[len(tx.Data())-32:])
|
||||
from := *tx.From()
|
||||
data[blkHash] = append(data[blkHash], from)
|
||||
}
|
||||
}
|
||||
c.BlockSigners.Add(header.Hash(), signTxs)
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,22 @@ func (tx *Transaction) IsSigningTransaction() bool {
|
|||
if tx.To() == nil {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue