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 static class BlockPair {
|
||||||
public StoredBlock storedBlock;
|
public final Block block;
|
||||||
public 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. */
|
/** Emulates receiving a valid block that builds on top of the chain. */
|
||||||
|
@ -291,9 +296,7 @@ public class FakeTxBuilder {
|
||||||
b.addTransaction(tx);
|
b.addTransaction(tx);
|
||||||
}
|
}
|
||||||
b.solve();
|
b.solve();
|
||||||
BlockPair pair = new BlockPair();
|
BlockPair pair = new BlockPair(b, previousStoredBlock.build(b));
|
||||||
pair.block = b;
|
|
||||||
pair.storedBlock = previousStoredBlock.build(b);
|
|
||||||
blockStore.put(pair.storedBlock);
|
blockStore.put(pair.storedBlock);
|
||||||
blockStore.setChainHead(pair.storedBlock);
|
blockStore.setChainHead(pair.storedBlock);
|
||||||
return pair;
|
return pair;
|
||||||
|
|
Loading…
Add table
Reference in a new issue