diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-26 21:49:50 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-26 21:51:41 +0000 |
commit | 52153a6e08df63ff19dd40b9119c6c010b1b1796 (patch) | |
tree | e6919e87da5d62a0ced29e6e831c3b73e402f153 /src/bitcoinrpc.cpp | |
parent | 689b878c33e41df0bd692ac3189a0e2089abf8bf (diff) | |
download | bitcoin-52153a6e08df63ff19dd40b9119c6c010b1b1796.tar.xz |
Minimal adaptations to getmemorypool for BIP 34
- As long as version 1 blocks are valid, provide them to getmemorypool clients (only)
- Include BIP 22 "height" key in getmemorypool output
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r-- | src/bitcoinrpc.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index efc69a4e43..9c9ff255d7 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1744,6 +1744,7 @@ Value getmemorypool(const Array& params, bool fHelp) " \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n" " \"time\" : timestamp appropriate for next block\n" " \"bits\" : compressed target of next block\n" + " \"height\" : height of the next block (backported, required by BIP 34)\n" "If [data] is specified, tries to solve the block and returns true if it was successful."); if (params.size() == 0) @@ -1779,6 +1780,12 @@ Value getmemorypool(const Array& params, bool fHelp) pblock = NULL; } pblock = CreateNewBlock(reservekey); + if (!((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexBest, 950, 1000)) || + (fTestNet && CBlockIndex::IsSuperMajority(2, pindexBest, 75, 100)))) + { + // As long as version 1 blocks are valid at all, use them to be more compatible with old implementations + pblock->nVersion = 1; + } if (!pblock) throw JSONRPCError(-7, "Out of memory"); @@ -1814,6 +1821,7 @@ Value getmemorypool(const Array& params, bool fHelp) } uBits; uBits.nBits = htonl((int32_t)pblock->nBits); result.push_back(Pair("bits", HexStr(BEGIN(uBits.cBits), END(uBits.cBits)))); + result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1))); return result; } |