[lbry] enable segwit
This commit is contained in:
parent
30f4bd6582
commit
41472404c6
4 changed files with 19 additions and 6 deletions
|
@ -230,8 +230,8 @@ func ValidateWitnessCommitment(blk *btcutil.Block) error {
|
||||||
coinbaseWitness := coinbaseTx.MsgTx().TxIn[0].Witness
|
coinbaseWitness := coinbaseTx.MsgTx().TxIn[0].Witness
|
||||||
if len(coinbaseWitness) != 1 {
|
if len(coinbaseWitness) != 1 {
|
||||||
str := fmt.Sprintf("the coinbase transaction has %d items in "+
|
str := fmt.Sprintf("the coinbase transaction has %d items in "+
|
||||||
"its witness stack when only one is allowed",
|
"its witness stack when only one is allowed. Height: %d",
|
||||||
len(coinbaseWitness))
|
len(coinbaseWitness), blk.Height())
|
||||||
return ruleError(ErrInvalidWitnessCommitment, str)
|
return ruleError(ErrInvalidWitnessCommitment, str)
|
||||||
}
|
}
|
||||||
witnessNonce := coinbaseWitness[0]
|
witnessNonce := coinbaseWitness[0]
|
||||||
|
|
|
@ -20,11 +20,11 @@ const (
|
||||||
// weight of a "base" byte is 4, while the weight of a witness byte is
|
// 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
|
// 1. As a result, for a block to be valid, the BlockWeight MUST be
|
||||||
// less than, or equal to MaxBlockWeight.
|
// less than, or equal to MaxBlockWeight.
|
||||||
MaxBlockWeight = 4000000
|
MaxBlockWeight = 8000000
|
||||||
|
|
||||||
// MaxBlockBaseSize is the maximum number of bytes within a block
|
// MaxBlockBaseSize is the maximum number of bytes within a block
|
||||||
// which can be allocated to non-witness data.
|
// which can be allocated to non-witness data.
|
||||||
MaxBlockBaseSize = 2000000
|
MaxBlockBaseSize = 8000000
|
||||||
|
|
||||||
// MaxBlockSigOpsCost is the maximum number of signature operations
|
// MaxBlockSigOpsCost is the maximum number of signature operations
|
||||||
// allowed for a block. It is calculated via a weighted algorithm which
|
// allowed for a block. It is calculated via a weighted algorithm which
|
||||||
|
|
|
@ -1293,9 +1293,16 @@ func (sm *SyncManager) handleInvMsg(imsg *invMsg) {
|
||||||
break
|
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
|
state.requestQueue = requestQueue
|
||||||
if len(gdmsg.InvList) > 0 {
|
if len(gdmsg.InvList) > 0 {
|
||||||
peer.QueueMessage(gdmsg, nil)
|
peer.QueueMessageWithEncoding(gdmsg, nil, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2241,9 +2241,15 @@ func newPeerBase(origCfg *Config, inbound bool) *Peer {
|
||||||
cfg.TrickleInterval = DefaultTrickleInterval
|
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{
|
p := Peer{
|
||||||
inbound: inbound,
|
inbound: inbound,
|
||||||
wireEncoding: wire.BaseEncoding,
|
wireEncoding: encoding,
|
||||||
knownInventory: lru.NewCache(maxKnownInventory),
|
knownInventory: lru.NewCache(maxKnownInventory),
|
||||||
stallControl: make(chan stallControlMsg, 1), // nonblocking sync
|
stallControl: make(chan stallControlMsg, 1), // nonblocking sync
|
||||||
outputQueue: make(chan outMsg, outputBufferSize),
|
outputQueue: make(chan outMsg, outputBufferSize),
|
||||||
|
|
Loading…
Reference in a new issue