btcd icon indicating copy to clipboard operation
btcd copied to clipboard

behavior of getblocktemplate regarding segwit

Open BrannonKing opened this issue 2 years ago • 5 comments

It seems that the present implementation of getblocktemplate ignores the "rules" input completely. How does that affect its output? Does it produce segwit'd output if segwit is active, regardless of the rules? Should it return an error if there is no segwit rule passed in but segwit is active?

BrannonKing avatar Jul 30 '21 15:07 BrannonKing

It should at least output a !segwit rule if it generates segwit data (aka, hits the code to include the witness portion), true? It looks like no rules are output at present.

BrannonKing avatar Jul 30 '21 16:07 BrannonKing

Does it produce segwit'd output if segwit is active, regardless of the rules? Should it return an error if there is no segwit rule passed in but segwit is active?

Atm, yes, we'll instead rly on our version bits state to decide if the segwit commitment should be added or not: https://github.com/btcsuite/btcd/blob/master/mining/mining.go#L605

The rules field is present, but not currently observed. PRs accepted to update the logic here

Roasbeef avatar Sep 24 '21 23:09 Roasbeef