@Test public void testToString() throws Exception { TransactionWitness w1 = new TransactionWitness(0); assertEquals("", w1.toString()); TransactionWitness w2 = new TransactionWitness(2); assertEquals("", w2.toString()); TransactionWitness w3 = new TransactionWitness(3); w3.setPush(0, Utils.HEX.decode("123aaa")); w3.setPush(1, Utils.HEX.decode("123bbb")); w3.setPush(3, Utils.HEX.decode("123ccc")); assertEquals("123aaa 123bbb EMPTY 123ccc", w3.toString()); }
@Override public String toString() { List<String> stringPushes = new ArrayList<>(pushes.size()); for (byte[] push : pushes) { if (push == null) { stringPushes.add("NULL"); } else if (push.length == 0) { stringPushes.add("EMPTY"); } else { stringPushes.add(Utils.HEX.encode(push)); } } return Utils.SPACE_JOINER.join(stringPushes); }
TransactionWitness { @Override public String toString() { List<String> stringPushes = new ArrayList<>(pushes.size()); for (byte[] push : pushes) { if (push == null) { stringPushes.add("NULL"); } else if (push.length == 0) { stringPushes.add("EMPTY"); } else { stringPushes.add(Utils.HEX.encode(push)); } } return Utils.SPACE_JOINER.join(stringPushes); } }
TransactionWitness { @Override public String toString() { List<String> stringPushes = new ArrayList<>(pushes.size()); for (byte[] push : pushes) { if (push == null) { stringPushes.add("NULL"); } else if (push.length == 0) { stringPushes.add("EMPTY"); } else { stringPushes.add(Utils.HEX.encode(push)); } } return Utils.SPACE_JOINER.join(stringPushes); } TransactionWitness(int pushCount); }
TransactionWitness { @Override public String toString() { List<String> stringPushes = new ArrayList<>(pushes.size()); for (byte[] push : pushes) { if (push == null) { stringPushes.add("NULL"); } else if (push.length == 0) { stringPushes.add("EMPTY"); } else { stringPushes.add(Utils.HEX.encode(push)); } } return Utils.SPACE_JOINER.join(stringPushes); } TransactionWitness(int pushCount); static TransactionWitness redeemP2WPKH(@Nullable TransactionSignature signature, ECKey pubKey); byte[] getPush(int i); int getPushCount(); void setPush(int i, byte[] value); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
TransactionWitness { @Override public String toString() { List<String> stringPushes = new ArrayList<>(pushes.size()); for (byte[] push : pushes) { if (push == null) { stringPushes.add("NULL"); } else if (push.length == 0) { stringPushes.add("EMPTY"); } else { stringPushes.add(Utils.HEX.encode(push)); } } return Utils.SPACE_JOINER.join(stringPushes); } TransactionWitness(int pushCount); static TransactionWitness redeemP2WPKH(@Nullable TransactionSignature signature, ECKey pubKey); byte[] getPush(int i); int getPushCount(); void setPush(int i, byte[] value); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final TransactionWitness EMPTY; }