Make max payload for a transaction max block size.
The maximum payload for a transaction is limited to the size of a block rather than the maximum payload for a given message.
This commit is contained in:
parent
8679275090
commit
e7f808378e
2 changed files with 2 additions and 2 deletions
2
msgtx.go
2
msgtx.go
|
@ -300,7 +300,7 @@ func (msg *MsgTx) Command() string {
|
||||||
// MaxPayloadLength returns the maximum length the payload can be for the
|
// MaxPayloadLength returns the maximum length the payload can be for the
|
||||||
// receiver. This is part of the Message interface implementation.
|
// receiver. This is part of the Message interface implementation.
|
||||||
func (msg *MsgTx) MaxPayloadLength(pver uint32) uint32 {
|
func (msg *MsgTx) MaxPayloadLength(pver uint32) uint32 {
|
||||||
return maxMessagePayload
|
return MaxBlockPayload
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMsgTx returns a new bitcoin tx message that conforms to the Message
|
// NewMsgTx returns a new bitcoin tx message that conforms to the Message
|
||||||
|
|
|
@ -34,7 +34,7 @@ func TestTx(t *testing.T) {
|
||||||
|
|
||||||
// Ensure max payload is expected value for latest protocol version.
|
// Ensure max payload is expected value for latest protocol version.
|
||||||
// Num addresses (varInt) + max allowed addresses.
|
// Num addresses (varInt) + max allowed addresses.
|
||||||
wantPayload := uint32(1024 * 1024 * 32)
|
wantPayload := uint32(1000 * 1000)
|
||||||
maxPayload := msg.MaxPayloadLength(pver)
|
maxPayload := msg.MaxPayloadLength(pver)
|
||||||
if maxPayload != wantPayload {
|
if maxPayload != wantPayload {
|
||||||
t.Errorf("MaxPayloadLength: wrong max payload length for "+
|
t.Errorf("MaxPayloadLength: wrong max payload length for "+
|
||||||
|
|
Loading…
Reference in a new issue