Skip to content

Commit

Permalink
add some transaction test unit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Junze888 committed Apr 16, 2024
1 parent c764f14 commit cf37685
Show file tree
Hide file tree
Showing 2 changed files with 332 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/test/java/io/xdag/BlockBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public static Block generateNewTransactionBlock(Config config, KeyPair key, long
return b;
}

public static Block generateNewTransactionBlock(Config config, KeyPair key, long xdagTime, Address from, Address to,
XAmount amount, XAmount VariableFee) {
List<Address> refs = Lists.newArrayList();
List<KeyPair> keys = Lists.newArrayList();
refs.add(new Address(from.getAddress(), XDAG_FIELD_INPUT, amount,true)); // key1
refs.add(new Address(to.getAddress(), XDAG_FIELD_OUTPUT, amount,true));
keys.add(key);
Block b = new Block(config, xdagTime, refs, null, false, keys, null, 0, VariableFee); // orphan
b.signOut(key);
return b;
}

public static Block generateWalletTransactionBlock(Config config, KeyPair key, long xdagTime, Address from, Address to,
XAmount amount) {
List<Address> refs = Lists.newArrayList();
Expand Down
Loading

0 comments on commit cf37685

Please sign in to comment.