mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
broadcast_commit
This commit is contained in:
@@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
// for registering TMEventData as events.EventData
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-events"
|
||||
"github.com/tendermint/go-wire"
|
||||
)
|
||||
@@ -14,6 +15,7 @@ func EventStringUnbond() string { return "Unbond" }
|
||||
func EventStringRebond() string { return "Rebond" }
|
||||
func EventStringDupeout() string { return "Dupeout" }
|
||||
func EventStringFork() string { return "Fork" }
|
||||
func EventStringTx(tx Tx) string { return Fmt("Tx:%X", tx.Hash()) }
|
||||
|
||||
func EventStringNewBlock() string { return "NewBlock" }
|
||||
func EventStringNewBlockHeader() string { return "NewBlockHeader" }
|
||||
|
||||
+8
-1
@@ -6,6 +6,13 @@ import (
|
||||
|
||||
type Tx []byte
|
||||
|
||||
// NOTE: this is the hash of the go-wire encoded Tx.
|
||||
// Tx has no types at this level, so just length-prefixed.
|
||||
// Maybe it should just be the hash of the bytes tho?
|
||||
func (tx Tx) Hash() []byte {
|
||||
return merkle.SimpleHashFromBinary(tx)
|
||||
}
|
||||
|
||||
type Txs []Tx
|
||||
|
||||
func (txs Txs) Hash() []byte {
|
||||
@@ -15,7 +22,7 @@ func (txs Txs) Hash() []byte {
|
||||
case 0:
|
||||
return nil
|
||||
case 1:
|
||||
return merkle.SimpleHashFromBinary(txs[0])
|
||||
return txs[0].Hash()
|
||||
default:
|
||||
left := Txs(txs[:(len(txs)+1)/2]).Hash()
|
||||
right := Txs(txs[(len(txs)+1)/2:]).Hash()
|
||||
|
||||
Reference in New Issue
Block a user