Implement BIP0023 basic pool extensions support.
This commit implements the basic pool extension portion of the getblocktemplate RPC as defined by BIP0023. This is work towards #124.
This commit is contained in:
parent
fc5656894d
commit
db20f25ff7
1 changed files with 2 additions and 0 deletions
|
@ -1596,6 +1596,7 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld
|
||||||
|
|
||||||
// Generate the block template reply.
|
// Generate the block template reply.
|
||||||
header := &msgBlock.Header
|
header := &msgBlock.Header
|
||||||
|
targetDifficulty := fmt.Sprintf("%064x", btcchain.CompactToBig(header.Bits))
|
||||||
templateID := encodeTemplateID(state.prevHash, state.lastGenerated)
|
templateID := encodeTemplateID(state.prevHash, state.lastGenerated)
|
||||||
reply := btcjson.GetBlockTemplateResult{
|
reply := btcjson.GetBlockTemplateResult{
|
||||||
Bits: strconv.FormatInt(int64(header.Bits), 16),
|
Bits: strconv.FormatInt(int64(header.Bits), 16),
|
||||||
|
@ -1609,6 +1610,7 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld
|
||||||
LongPollID: templateID,
|
LongPollID: templateID,
|
||||||
SubmitOld: submitOld,
|
SubmitOld: submitOld,
|
||||||
MinTime: state.minTimestamp.Unix(),
|
MinTime: state.minTimestamp.Unix(),
|
||||||
|
Target: targetDifficulty,
|
||||||
}
|
}
|
||||||
if useCoinbaseValue {
|
if useCoinbaseValue {
|
||||||
reply.CoinbaseAux = gbtCoinbaseAux
|
reply.CoinbaseAux = gbtCoinbaseAux
|
||||||
|
|
Loading…
Reference in a new issue