From dbfd58da8627fff3f8f3a8e253cfc92486746dfe Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Tue, 25 Jan 2022 10:50:58 -0600 Subject: [PATCH] Add log txids inside of inventories in big endian rather than little endian (#4013) --- .../scala/org/bitcoins/core/p2p/Inventory.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/main/scala/org/bitcoins/core/p2p/Inventory.scala b/core/src/main/scala/org/bitcoins/core/p2p/Inventory.scala index 4110e2e058..d07c774d34 100644 --- a/core/src/main/scala/org/bitcoins/core/p2p/Inventory.scala +++ b/core/src/main/scala/org/bitcoins/core/p2p/Inventory.scala @@ -15,6 +15,20 @@ case class Inventory(typeIdentifier: TypeIdentifier, hash: DoubleSha256Digest) extends NetworkElement { override def bytes: ByteVector = RawInventorySerializer.write(this) + + override def toString: String = { + typeIdentifier match { + case TypeIdentifier.MsgTx | TypeIdentifier.MsgWitnessTx => + //want to make a better toString here so it is easier to search txids + s"Inventory($typeIdentifier,txIdBE=${hash.flip.hex})" + case TypeIdentifier.MsgBlock | TypeIdentifier.MsgCompactBlock | + TypeIdentifier.MsgFilteredBlock | TypeIdentifier.MsgFilteredBlock | + TypeIdentifier.MsgCompactBlock | + TypeIdentifier.MsgFilteredWitnessBlock | + TypeIdentifier.MsgWitnessBlock | _: MsgUnassigned => + super.toString + } + } } object Inventory extends Factory[Inventory] {