mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 04:01:55 +00:00
RPCResponse.Result && EventData are registered interfaces; -skip_upnp option
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
)
|
||||
|
||||
var config cfg.Config = nil
|
||||
|
||||
func init() {
|
||||
cfg.OnConfig(func(newConfig cfg.Config) {
|
||||
config = newConfig
|
||||
})
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
acm "github.com/tendermint/tendermint/account"
|
||||
"github.com/tendermint/tendermint/wire"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidBlockPartSignature = errors.New("Error invalid block part signature")
|
||||
ErrInvalidBlockPartHash = errors.New("Error invalid block part hash")
|
||||
)
|
||||
|
||||
type Proposal struct {
|
||||
Height int `json:"height"`
|
||||
Round int `json:"round"`
|
||||
BlockPartsHeader types.PartSetHeader `json:"block_parts_header"`
|
||||
POLRound int `json:"pol_round"` // -1 if null.
|
||||
Signature acm.SignatureEd25519 `json:"signature"`
|
||||
}
|
||||
|
||||
func NewProposal(height int, round int, blockPartsHeader types.PartSetHeader, polRound int) *Proposal {
|
||||
return &Proposal{
|
||||
Height: height,
|
||||
Round: round,
|
||||
BlockPartsHeader: blockPartsHeader,
|
||||
POLRound: polRound,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Proposal) String() string {
|
||||
return fmt.Sprintf("Proposal{%v/%v %v %v %v}", p.Height, p.Round,
|
||||
p.BlockPartsHeader, p.POLRound, p.Signature)
|
||||
}
|
||||
|
||||
func (p *Proposal) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) {
|
||||
wire.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err)
|
||||
wire.WriteTo([]byte(`,"proposal":{"block_parts_header":`), w, n, err)
|
||||
p.BlockPartsHeader.WriteSignBytes(w, n, err)
|
||||
wire.WriteTo([]byte(Fmt(`,"height":%v,"pol_round":%v`, p.Height, p.POLRound)), w, n, err)
|
||||
wire.WriteTo([]byte(Fmt(`,"round":%v}}`, p.Round)), w, n, err)
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
acm "github.com/tendermint/tendermint/account"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
_ "github.com/tendermint/tendermint/config/tendermint_test"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
func TestProposalSignable(t *testing.T) {
|
||||
proposal := &Proposal{
|
||||
Height: 12345,
|
||||
Round: 23456,
|
||||
BlockPartsHeader: types.PartSetHeader{111, []byte("blockparts")},
|
||||
POLRound: -1,
|
||||
}
|
||||
signBytes := acm.SignBytes(config.GetString("chain_id"), proposal)
|
||||
signStr := string(signBytes)
|
||||
|
||||
expected := Fmt(`{"chain_id":"%s","proposal":{"block_parts_header":{"hash":"626C6F636B7061727473","total":111},"height":12345,"pol_round":-1,"round":23456}}`,
|
||||
config.GetString("chain_id"))
|
||||
if signStr != expected {
|
||||
t.Errorf("Got unexpected sign string for SendTx. Expected:\n%v\nGot:\n%v", expected, signStr)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user