diff --git a/blockchain/merkle.go b/blockchain/merkle.go index 8f3f6b97..f4b902f1 100644 --- a/blockchain/merkle.go +++ b/blockchain/merkle.go @@ -230,8 +230,8 @@ func ValidateWitnessCommitment(blk *btcutil.Block) error { coinbaseWitness := coinbaseTx.MsgTx().TxIn[0].Witness if len(coinbaseWitness) != 1 { str := fmt.Sprintf("the coinbase transaction has %d items in "+ - "its witness stack when only one is allowed", - len(coinbaseWitness)) + "its witness stack when only one is allowed. Height: %d", + len(coinbaseWitness), blk.Height()) return ruleError(ErrInvalidWitnessCommitment, str) } witnessNonce := coinbaseWitness[0] diff --git a/blockchain/weight.go b/blockchain/weight.go index e23dd87d..a2a07507 100644 --- a/blockchain/weight.go +++ b/blockchain/weight.go @@ -20,11 +20,11 @@ const ( // weight of a "base" byte is 4, while the weight of a witness byte is // 1. As a result, for a block to be valid, the BlockWeight MUST be // less than, or equal to MaxBlockWeight. - MaxBlockWeight = 4000000 + MaxBlockWeight = 8000000 // MaxBlockBaseSize is the maximum number of bytes within a block // which can be allocated to non-witness data. - MaxBlockBaseSize = 2000000 + MaxBlockBaseSize = 8000000 // MaxBlockSigOpsCost is the maximum number of signature operations // allowed for a block. It is calculated via a weighted algorithm which diff --git a/netsync/manager.go b/netsync/manager.go index 2b6c0411..a56433dd 100644 --- a/netsync/manager.go +++ b/netsync/manager.go @@ -1293,9 +1293,16 @@ func (sm *SyncManager) handleInvMsg(imsg *invMsg) { break } } + + e := wire.BaseEncoding + // we think that the iv.Type set above is sufficient. If not: + // if peer.IsWitnessEnabled() { + // e = wire.WitnessEncoding + //} + state.requestQueue = requestQueue if len(gdmsg.InvList) > 0 { - peer.QueueMessage(gdmsg, nil) + peer.QueueMessageWithEncoding(gdmsg, nil, e) } } diff --git a/peer/peer.go b/peer/peer.go index 92ac3d27..47d30959 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -2226,9 +2226,15 @@ func newPeerBase(origCfg *Config, inbound bool) *Peer { cfg.TrickleInterval = DefaultTrickleInterval } + encoding := wire.BaseEncoding + // we think this gets overwritten downstream. If not: + // if cfg.Services&wire.SFNodeWitness > 0 { + // encoding = wire.WitnessEncoding + //} + p := Peer{ inbound: inbound, - wireEncoding: wire.BaseEncoding, + wireEncoding: encoding, knownInventory: lru.NewCache(maxKnownInventory), stallControl: make(chan stallControlMsg, 1), // nonblocking sync outputQueue: make(chan outMsg, outputBufferSize),