use of org.bitcoinj.params.MainNetParams in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_signature.
@Test
public void test_signature() throws KeyStoreException {
ScriptBuilder2 sb = new ScriptBuilder2();
assertEquals(0, sb.size());
assertEquals(0, sb.getFreeVariables().size());
assertEquals(0, sb.signatureSize());
ECKey k1 = new ECKey();
ECKey k2 = new ECKey();
ecks.addKey(k1);
ecks.addKey(k2);
sb.signaturePlaceholder(k1, SigHash.ALL, false);
sb.signaturePlaceholder(k2, SigHash.ALL, false);
System.out.println(sb);
assertEquals(2, sb.size());
assertEquals(0, sb.getFreeVariables().size());
assertEquals(2, sb.signatureSize());
Transaction tx = new Transaction(new MainNetParams());
tx.addInput(new TransactionInput(new MainNetParams(), null, new byte[] { 42, 42 }));
sb.setAllSignatures(ecks, tx, 0, new byte[] {});
System.out.println(sb);
assertEquals(2, sb.size());
assertEquals(0, sb.getFreeVariables().size());
assertEquals(0, sb.signatureSize());
}
Aggregations