From 48579851d7b630edc612de98d9fed0a49ea71467 Mon Sep 17 00:00:00 2001 From: Ben Carman Date: Tue, 8 Dec 2020 08:13:42 -0600 Subject: [PATCH] Add latest ProtocolVersion (#2332) --- .../org/bitcoins/core/p2p/ProtocolVersion.scala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/bitcoins/core/p2p/ProtocolVersion.scala b/core/src/main/scala/org/bitcoins/core/p2p/ProtocolVersion.scala index 4cc3c34bba..a527e3e535 100644 --- a/core/src/main/scala/org/bitcoins/core/p2p/ProtocolVersion.scala +++ b/core/src/main/scala/org/bitcoins/core/p2p/ProtocolVersion.scala @@ -30,12 +30,15 @@ object ProtocolVersion extends Factory[ProtocolVersion] { ProtocolVersion70001, ProtocolVersion70002, ProtocolVersion70012, - ProtocolVersion70013 + ProtocolVersion70013, + ProtocolVersion70014, + ProtocolVersion70015, + ProtocolVersion70016 ) def fromBytes(bytes: ByteVector): ProtocolVersion = { //TODO: Should we default to the latest protocol version if the bytes don't match??? - versions.find(v => v.bytes == bytes).getOrElse(ProtocolVersion70015) + versions.find(v => v.bytes == bytes).getOrElse(versions.last) } } @@ -162,3 +165,12 @@ case object ProtocolVersion70014 extends ProtocolVersion { case object ProtocolVersion70015 extends ProtocolVersion { override val bytes: ByteVector = hex"7f110100" } + +/** + * Indicates that a node prefers to relay transactions via wtxid, rather than txid. + * Protocol version 70016 as described by BIP 339. + * Bitcoin Core 0.21.0 (December 2020) + */ +case object ProtocolVersion70016 extends ProtocolVersion { + override val bytes: ByteVector = hex"80110100" +}