mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
FakeTxBuilder: make BlockPair fields immutable
This commit is contained in:
parent
fea737b39b
commit
04a783282d
1 changed files with 8 additions and 5 deletions
|
@ -262,8 +262,13 @@ public class FakeTxBuilder {
|
|||
}
|
||||
|
||||
public static class BlockPair {
|
||||
public StoredBlock storedBlock;
|
||||
public Block block;
|
||||
public final Block block;
|
||||
public final StoredBlock storedBlock;
|
||||
|
||||
public BlockPair(Block block, StoredBlock storedBlock) {
|
||||
this.storedBlock = storedBlock;
|
||||
this.block = block;
|
||||
}
|
||||
}
|
||||
|
||||
/** Emulates receiving a valid block that builds on top of the chain. */
|
||||
|
@ -291,9 +296,7 @@ public class FakeTxBuilder {
|
|||
b.addTransaction(tx);
|
||||
}
|
||||
b.solve();
|
||||
BlockPair pair = new BlockPair();
|
||||
pair.block = b;
|
||||
pair.storedBlock = previousStoredBlock.build(b);
|
||||
BlockPair pair = new BlockPair(b, previousStoredBlock.build(b));
|
||||
blockStore.put(pair.storedBlock);
|
||||
blockStore.setChainHead(pair.storedBlock);
|
||||
return pair;
|
||||
|
|
Loading…
Add table
Reference in a new issue