Page MenuHomePhabricator

D366.id.diff
No OneTemporary

D366.id.diff

diff --git a/qa/rpc-tests/abc-rpc.py b/qa/rpc-tests/abc-rpc.py
--- a/qa/rpc-tests/abc-rpc.py
+++ b/qa/rpc-tests/abc-rpc.py
@@ -10,6 +10,7 @@
import re
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
+from test_framework.mininode import NODE_BITCOIN_CASH
from test_framework.cdefs import (ONE_MEGABYTE,
LEGACY_MAX_BLOCK_SIZE,
DEFAULT_MAX_BLOCK_SIZE)
@@ -155,9 +156,18 @@
# Not allowed to update anymore.
check_cannot_update_starttime()
+ def test_cashservicebit(self):
+ # Check that NODE_BITCOIN_CASH bit is set.
+ # This can be seen in the 'localservices' entry of getnetworkinfo RPC.
+ node = self.nodes[0]
+ nw_info = node.getnetworkinfo()
+ assert_equal(int(nw_info['localservices'], 16) & NODE_BITCOIN_CASH,
+ NODE_BITCOIN_CASH)
+
def run_test(self):
self.test_excessiveblock()
self.test_uahfstarttime()
+ self.test_cashservicebit()
if __name__ == '__main__':
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py
--- a/qa/rpc-tests/test_framework/mininode.py
+++ b/qa/rpc-tests/test_framework/mininode.py
@@ -52,6 +52,8 @@
NODE_GETUTXO = (1 << 1)
NODE_BLOOM = (1 << 2)
NODE_WITNESS = (1 << 3)
+NODE_XTHIN = (1 << 4)
+NODE_BITCOIN_CASH = (1 << 5)
# Howmuch data will be read from the network at once
READ_BUFFER_SIZE = 8192
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1527,6 +1527,11 @@
if (GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
+ // Signal Bitcoin Cash support.
+ // TODO: remove some time after the hardfork when no longer needed
+ // to differentiate the network nodes.
+ nLocalServices = ServiceFlags(nLocalServices | NODE_BITCOIN_CASH);
+
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
if (mapMultiArgs.count("-bip9params")) {
diff --git a/src/protocol.h b/src/protocol.h
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -267,6 +267,13 @@
// NODE_XTHIN means the node supports Xtreme Thinblocks. If this is turned
// off then the node will not service nor make xthin requests.
NODE_XTHIN = (1 << 4),
+ // NODE_BITCOIN_CASH means the node supports Bitcoin Cash and the
+ // associated consensus rule changes.
+ // This service bit is intended to be used prior until some time after the
+ // UAHF activation when the Bitcoin Cash network has adequately separated.
+ // TODO: remove (free up) the NODE_BITCOIN_CASH service bit once no longer
+ // needed.
+ NODE_BITCOIN_CASH = (1 << 5),
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
// isn't getting used, or one not being used much, and notify the
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -902,6 +902,9 @@
case NODE_XTHIN:
strList.append("XTHIN");
break;
+ case NODE_BITCOIN_CASH:
+ strList.append("CASH");
+ break;
default:
strList.append(QString("%1[%2]").arg("UNKNOWN").arg(check));
}

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 23:01 (4 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866122
Default Alt Text
D366.id.diff (3 KB)

Event Timeline