fix for clear witness

This commit is contained in:
Craig Raw 2020-07-23 14:13:57 +02:00
parent 8bc4e3b3dc
commit 5cd203d366

View file

@ -101,9 +101,10 @@ public class TransactionInput extends ChildMessage {
} }
public void setWitness(TransactionWitness witness) { public void setWitness(TransactionWitness witness) {
int newLength = witness != null ? witness.getLength() : 0;
int existingLength = getWitness() != null ? getWitness().getLength() : 0; int existingLength = getWitness() != null ? getWitness().getLength() : 0;
if(getParent() != null) { if(getParent() != null) {
getParent().adjustLength(witness.getLength() - existingLength); getParent().adjustLength(newLength - existingLength);
} }
this.witness = witness; this.witness = witness;