mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-17 17:11:19 +00:00
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
|
package core
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/tendermint/tendermint/crypto"
|
||
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||
|
"github.com/tendermint/tendermint/types"
|
||
|
)
|
||
|
|
||
|
// ### Query Parameters
|
||
|
//
|
||
|
// | Parameter | Type | Default | Required | Description |
|
||
|
// |-----------+--------+---------+----------+-------------------------------|
|
||
|
// | pubkey | PubKey | nil | true | PubKey of the byzantine actor |
|
||
|
// | vote1 | Vote | nil | true | First vote |
|
||
|
// | vote2 | Vote | nil | true | Second vote |
|
||
|
func BroadcastDuplicateVote(pubkey crypto.PubKey, vote1 types.Vote, vote2 types.Vote) (*ctypes.ResultBroadcastDuplicateVote, error) {
|
||
|
chainID := p2pTransport.NodeInfo().Network
|
||
|
ev := &types.DuplicateVoteEvidence{pubkey, &vote1, &vote2}
|
||
|
if err := vote1.Verify(chainID, pubkey); err != nil {
|
||
|
return nil, fmt.Errorf("Error broadcasting evidence: %v", err)
|
||
|
}
|
||
|
|
||
|
err := evidencePool.AddEvidence(ev)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Error broadcasting evidence: %v", err)
|
||
|
}
|
||
|
return &ctypes.ResultBroadcastDuplicateVote{ev.Hash()}, nil
|
||
|
}
|