Andreas Schildbach
7b8b8650bc
BlockChainTest, ChainSplitTest, ECKeyTest: use assertFalse(condition)
rather than assertTrue(!condition)
2023-04-01 11:40:31 +02:00
Andreas Schildbach
4fb4fe2380
BlockChainTest: flip expected value to the front for assertEquals()
2023-04-01 11:35:58 +02:00
Andreas Schildbach
a2abdfa136
TransactionTest: migrate remaining assertTrue()
/assertFalse()
from assertEquals()
2023-04-01 10:48:29 +02:00
Andreas Schildbach
efdef581ee
Transaction: make network
in toString()
an optional parameter
...
If it isn't provided, standard output scripts cannot be converted to
addresses.
2023-04-01 10:27:43 +02:00
Andreas Schildbach
44b0ddeb59
Transaction: remove toHexString()
...
This makes a scary assumption on the format being used (segwit or not).
2023-04-01 10:25:15 +02:00
Sean Gilligan
772bccd5f8
MemoryBlockStore: construct with genesis block
...
It doesn't need an entire `NetworkParameters`.
2023-03-31 22:14:06 +02:00
Andreas Schildbach
0a5560dc4c
Transaction: make allowWitness()
static and let it decide on protocolVersion
only
...
It doesn't need an entire `MessageSerializer`.
2023-03-31 22:07:15 +02:00
Andreas Schildbach
f4e7f03c0b
Transaction: remove method calcLength()
...
It is not used any more.
2023-03-31 21:51:15 +02:00
Andreas Schildbach
880b4aff8e
Transaction: use getMessageSize()
to determine size in toString()
...
It's quicker, as for this class there is an optimization without
serializing the entire message.
2023-03-31 21:36:59 +02:00
Sean Gilligan
23d1ce97b5
WalletTool: use net
over params
where possible
...
Note that `params` is initialized from `net`.
2023-03-31 21:01:16 +02:00
Sean Gilligan
04ff5335cf
WalletTool: separate try block for setup/peerGroup.start in send()
...
This makes it more clear which operations throw `BlockStoreException`
and which throw `ExecutionException` or `InterruptedException`.
2023-03-31 20:58:01 +02:00
Sean Gilligan
1e088596df
WalletTool: remove nested try in send()
...
This makes the code much more readable as you can see which operations
throw which exceptions and how they are handled.
2023-03-31 20:56:03 +02:00
Sean Gilligan
f41e5f2e1e
WalletTool: remove explicit handling of KeyCrypterException
from send()
...
`KeyCrypterException` is a runtime exception so there is no need
to catch and rethrow wrapped as a `RuntimeException`.
2023-03-31 20:52:34 +02:00
Andreas Schildbach
f588b8e945
TransactionInput, TransactionOutput: make setParent()
protected
...
Rather than using this method, we should prefer passing the parent
transaction via constructor.
2023-03-31 20:25:06 +02:00
Andreas Schildbach
81fb0c5acb
Transaction, TransactionInput, TransactionOutPoint: add static constructors for the elements of a coinbase
...
This should reduce misuse of the standard constructors.
2023-03-31 19:28:11 +02:00
Sean Gilligan
820b671dbc
StoredBlock: make deserializeCompact()
use serializer
...
...not `params`.
2023-03-31 18:35:58 +02:00
Sean Gilligan
98d4df5fe5
BlockChainTest: reduce usage of UNITTEST
...
Use `TESTNET` or `BitcoinNetwork.TESTNET` for `Transaction`, `Address` and
`Wallet`.
2023-03-31 16:06:58 +02:00
Andreas Schildbach
a3f82d6bae
TransactionInput: remove helper duplicateDetached()
...
It is only used from a test, and that test works just as well by
just copying the reference.
2023-03-31 15:58:23 +02:00
Andreas Schildbach
81adac9f1e
Wallet: fix usage of wrong TransactionInput
constructor
2023-03-31 14:21:57 +02:00
Sean Gilligan
cc901ee863
BlockStore: remove getParams()
from the hierarchy
...
Nothing in bitcoinj is using this method and applications should not
be getting their `NetworkParameters` from their storage layer.
2023-03-31 09:57:29 +02:00
Sean Gilligan
99f6860ceb
UTXOProvider: replace getParams()
with network()
...
Since this only affects FullPrunedBlockStore, this change doesn't
need deprecation.
2023-03-31 09:54:59 +02:00
Andreas Schildbach
24e030ae74
Transaction, TransactionInput, TransactionOutput, PartialMerkleTree: use readLengthPrefixedBytes()
where appropriate
2023-03-31 01:57:48 +02:00
Sean Gilligan
786a1e1953
Script: migrate to Network
from NetworkParameters
...
Provide deprecated methods for compatibility.
2023-03-31 01:23:27 +02:00
Andreas Schildbach
eb531166ee
TransactionOutput: remove params
from constructors
...
To make this possible, a check for maximum value is removed.
2023-03-30 23:43:17 +02:00
Andreas Schildbach
5d466ea57c
Peer: fix default of the minimum protocol version of remote peers
...
It should be `NetworkParameters.ProtocolVersion.MINIMUM` (currently 70000).
2023-03-30 23:41:06 +02:00
Andreas Schildbach
dd07d2cf62
NetworkParameters: fix protocol version for BIP37 bloom filters
...
According to BIP111, the protocol version must be greater than 70000.
Since we use "greater or equals", 70001 is the correct number.
2023-03-30 23:39:12 +02:00
Sean Gilligan
90fc2bfb5e
BlockFileLoader, FullBlockTestGenerator: use readUint32()/writeInt32LE()
rather than manually reversing bytes
2023-03-30 23:34:50 +02:00
Andreas Schildbach
f0b69a405f
VersionMessage: require extended version handshake messages
...
Versions without the extended fields (e.g. user-agent, block height) are not
protocol compliant since version 106. Our minimum version is at 70000.
2023-03-30 23:29:55 +02:00
Andreas Schildbach
8aeb5d3b1c
TransactionInput: remove params
from constructors
2023-03-30 23:00:04 +02:00
Andreas Schildbach
f2376e3ba3
PartialMerkleTree: remove params
from constructors
2023-03-30 22:39:05 +02:00
Sean Gilligan
16faad2a30
NetworkParameters: change packetMagic
to an int
...
It's just a binary value and does not have signedness.
Methods for writing 32-bit integers via `ByteUtils.writeInt32BE(int, ...)` have been added.
2023-03-30 22:19:06 +02:00
Andreas Schildbach
8c6e584e02
AddressMessage: remove params
and serializer
from constructors in hierarchy
2023-03-30 19:01:25 +02:00
Sean Gilligan
8576602180
BlockFileLoader: convert to Network
, deprecate constructors with NetworkParameters
2023-03-30 18:59:19 +02:00
Andreas Schildbach
3e8f7d93a7
DummySerializer: make capable of pretending specific protocol version
...
This is put to use for the "misuse of protocol version" for `PeerAddress`.
2023-03-30 18:17:16 +02:00
Andreas Schildbach
773a9aeb4e
PeerAddress: remove params
from constructor
...
To make this possible, a port has to be specified in all cases.
2023-03-30 18:03:18 +02:00
Andreas Schildbach
6472080ab3
Message: remove method unCache()
...
It's still implemented in `Block`, `Transaction`, `TransactionInput` and
`TransactionOutput`. But there is no need to have it in the superclass.
2023-03-30 18:00:34 +02:00
Andreas Schildbach
b9d37e024f
Message: get rid of payload
field
...
It's now passed into the `parse()` method, and passed along from there.
2023-03-30 17:58:22 +02:00
Andreas Schildbach
9c9548dc23
TransactionOutput: remove serializer
from constructor
2023-03-30 15:09:44 +02:00
Andreas Schildbach
c1a32f6585
TransactionInput: remove serializer
from constructor
2023-03-30 15:06:41 +02:00
Andreas Schildbach
8091384ff6
UnknownMessage: make field name
immutable
2023-03-30 14:29:17 +02:00
Andreas Schildbach
455973557a
Message: add a defensive null check to getParams()
2023-03-30 13:15:05 +02:00
Sean Gilligan
3bc82cd9f7
TransactionInput, TransactionOutput: make direct subclass of Message
...
Since only these 2 classes need to support the concept of a "parent", it
will be simpler to just add the code to handle that to both of them and
remove the `ChildMessage` altogether.
2023-03-30 11:33:29 +02:00
Sean Gilligan
368d2f2c63
BlockFileLoader: don't use NetworkParameters
internally
...
Save `packetMagic` and `serializer` instead.
2023-03-30 01:50:14 +02:00
Andreas Schildbach
57c9456ce8
TransactionOutPoint: remove params
from constructors
2023-03-30 01:42:50 +02:00
Andreas Schildbach
42bf963d92
MessageTest: remove params
from VarStrMessage
...
This time for real.
2023-03-30 01:32:02 +02:00
Andreas Schildbach
54d0c80e16
GetBlocksMessage, GetHeadersMessage: remove params
from constructors
...
Because the serialized messages contain the protocol version – for whatever
reason, possibly unused – that value is now passed instead.
2023-03-30 01:25:19 +02:00
Sean Gilligan
4a62b0f53d
Fix spelling of "freestanding" in comments
2023-03-30 01:22:29 +02:00
Andreas Schildbach
a3d8d24d6f
MessageTest: remove params
from VarStrMessage
2023-03-30 01:19:54 +02:00
Andreas Schildbach
ed84988111
MemoryPoolMessage: make it an EmptyMessage
2023-03-30 01:16:03 +02:00
Andreas Schildbach
d02853b1f0
TransactionOutPoint: make direct subclass of Message
...
It doesn't need a parent.
2023-03-30 01:04:41 +02:00