|
@ -5,7 +5,7 @@ import ( |
|
|
"fmt" |
|
|
"fmt" |
|
|
"io" |
|
|
"io" |
|
|
|
|
|
|
|
|
. "github.com/tendermint/go-common" |
|
|
|
|
|
|
|
|
//. "github.com/tendermint/go-common"
|
|
|
"github.com/tendermint/go-crypto" |
|
|
"github.com/tendermint/go-crypto" |
|
|
"github.com/tendermint/go-wire" |
|
|
"github.com/tendermint/go-wire" |
|
|
) |
|
|
) |
|
@ -16,12 +16,12 @@ var ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
type Proposal struct { |
|
|
type Proposal struct { |
|
|
Height int `json:"height"` |
|
|
|
|
|
Round int `json:"round"` |
|
|
|
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
|
|
|
POLRound int `json:"pol_round"` // -1 if null.
|
|
|
|
|
|
POLBlockID BlockID `json:"pol_block_id"` // zero if null.
|
|
|
|
|
|
Signature crypto.SignatureEd25519 `json:"signature"` |
|
|
|
|
|
|
|
|
Height int `json:"height"` |
|
|
|
|
|
Round int `json:"round"` |
|
|
|
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
|
|
|
POLRound int `json:"pol_round"` // -1 if null.
|
|
|
|
|
|
POLBlockID BlockID `json:"pol_block_id"` // zero if null.
|
|
|
|
|
|
Signature crypto.Signature `json:"signature"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// polRound: -1 if no polRound.
|
|
|
// polRound: -1 if no polRound.
|
|
@ -41,11 +41,32 @@ func (p *Proposal) String() string { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (p *Proposal) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) { |
|
|
func (p *Proposal) WriteSignBytes(chainID string, w io.Writer, n *int, 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_block_id":`, p.Height)), w, n, err) |
|
|
|
|
|
p.POLBlockID.WriteSignBytes(w, n, err) |
|
|
|
|
|
wire.WriteTo([]byte(Fmt(`,"pol_round":%v`, p.POLRound)), w, n, err) |
|
|
|
|
|
wire.WriteTo([]byte(Fmt(`,"round":%v}}`, p.Round)), w, n, err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wire.WriteJSON( |
|
|
|
|
|
struct { |
|
|
|
|
|
ChainID string `json:"chain_id"` |
|
|
|
|
|
Proposal struct { |
|
|
|
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
|
|
|
Height int `json:"height"` |
|
|
|
|
|
POLBlockID BlockID `json:"pol_block_id"` |
|
|
|
|
|
POLRound int `json:"pol_round"` |
|
|
|
|
|
Round int `json:"round"` |
|
|
|
|
|
} `json:"proposal"` |
|
|
|
|
|
}{ |
|
|
|
|
|
chainID, |
|
|
|
|
|
struct { |
|
|
|
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
|
|
|
Height int `json:"height"` |
|
|
|
|
|
POLBlockID BlockID `json:"pol_block_id"` |
|
|
|
|
|
POLRound int `json:"pol_round"` |
|
|
|
|
|
Round int `json:"round"` |
|
|
|
|
|
}{ |
|
|
|
|
|
p.BlockPartsHeader, |
|
|
|
|
|
p.Height, |
|
|
|
|
|
p.POLBlockID, |
|
|
|
|
|
p.POLRound, |
|
|
|
|
|
p.Round, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
w, n, err) |
|
|
} |
|
|
} |