From 5cd203d3668d8e720244686433cbd44d614f0343 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 23 Jul 2020 14:13:57 +0200 Subject: [PATCH] fix for clear witness --- .../com/sparrowwallet/drongo/protocol/TransactionInput.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java index 92f12ba..3cef84e 100644 --- a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java +++ b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java @@ -101,9 +101,10 @@ public class TransactionInput extends ChildMessage { } public void setWitness(TransactionWitness witness) { + int newLength = witness != null ? witness.getLength() : 0; int existingLength = getWitness() != null ? getWitness().getLength() : 0; if(getParent() != null) { - getParent().adjustLength(witness.getLength() - existingLength); + getParent().adjustLength(newLength - existingLength); } this.witness = witness;