Commit graph

2667 commits

Author SHA1 Message Date
Andreas Schildbach
d4df1119de SegwitAddress: Import Script rather than Script.ScriptType. 2019-05-05 16:59:28 +02:00
Matthew Leon
c87f4b3f77 SegwitAddress: Don't encode witness version to OP_N when constructing.
This bug was never exposed outside the SegwitAddress class (and thus can't be tested) because the encode method is only ever called by fromHash, where the script version is always set to 0.

Nevertheless, this bug could result in faults in future code, as other witness program versions begin to be used: The other construction methods, such as fromBech32(), leave the version byte as a simple representation of the version number. This means that, were the SegwitAddress constructor ever called with a non-0 version number, getWitnessVersion() would return an incorrect result, and ScriptBuilder.createOutputScript() would fail, re-running encodeToOpN() on the now greater-than-16 version byte.
2019-05-05 10:49:14 +02:00
Andreas Schildbach
106e2c8baa Use Bouncy Castle's Scrypt implementation rather than the standalone library.
Amazingly, on a Pixel 2 this implementation is a bit quicker than Will Glozer/Colin Percival's native code.
2019-05-04 15:28:41 +02:00
Andreas Schildbach
7d973c8487 DeterministicKeyChain: Add getter for rootKey. 2019-05-03 23:14:39 +02:00
Andreas Schildbach
d94380caec KeyChainFactory: Remove unused key and firstSubKey parameters from all factory methods. 2019-05-03 23:02:37 +02:00
Andreas Schildbach
82aed48962 ChildKeyDerivationTest: Fix second testcase of testChildKeyDerivation() is never tested. 2019-05-03 22:59:58 +02:00
Andreas Schildbach
1a8e4c9978 HDKeyDerivation: Add convenience methods deriveChildKeyFromPrivate() and deriveChildKeyFromPublic().
Also add extensive testing.
2019-05-03 22:55:20 +02:00
Andreas Schildbach
701fc38c00 HDKeyDerivation: Make precondition message more clear in deriveChildKeyBytesFromPublic(). 2019-05-03 22:50:37 +02:00
Andreas Schildbach
283d5fd27b WalletTest: More testing in roundTrip(). 2019-05-03 11:13:19 +02:00
Andreas Schildbach
6035608b02 Deprecate Transaction.MIN_NONDUST_OUTPUT and NetworkParameters.getMinNonDustOutput(). Remove DefaultRiskAnalysis.MIN_ANALYSIS_NONDUST_OUTPUT.
The dust threshold has always been dependent on the actual output script type. Even more so with the
SegWit discount. So use TransactionOutput.getMinNonDustValue() or .isDust().
2019-05-02 10:36:32 +02:00
Tim Strasser
9cf13d2931 ScriptPatternTest: Split testCommonScripts() into smaller tests. 2019-04-30 12:17:02 +02:00
Andreas Schildbach
40eff8cba2 UTXOsMessage: Clarify a comment. 2019-04-30 12:11:51 +02:00
Tim Strasser
9aa6f239ea PrefixedChecksummedBytesTest: Use proper mocking around class to test. 2019-04-30 11:57:10 +02:00
Oscar Guindzberg
56358f8ab5 Script: Add links to new methods replacing deprecated methods. 2019-04-29 10:34:16 +02:00
Oscar Guindzberg
84a8446a2f TransactionConfidence: Fix typo in JavaDoc. 2019-04-29 10:31:12 +02:00
Andreas Schildbach
c168e67703 Wallet: Implement witness fee discount.
Fee is now specified in virtual (kilo)bytes. For non-segwit transactions a virtual byte is the same as a byte so the change is backward compatible.
2019-04-29 10:03:04 +02:00
Andreas Schildbach
2fc1b1131c Transaction: Move sizes to top in toString(), and print the weight too. 2019-04-29 09:31:56 +02:00
Andreas Schildbach
c97ecf6046 Transaction: Add methods for calculating transaction weight and virtual transaction size. 2019-04-28 19:16:50 +02:00
Andreas Schildbach
6d7866d476 TestWithWallet: Use proper key and address derivation for test wallet. 2019-04-28 19:16:06 +02:00
Andreas Schildbach
25f36872d5 TransactionOutput: Consider the witness discount in getMinNonDustValue(). 2019-04-28 15:22:53 +02:00
Andreas Schildbach
fb353d744e Fix unbalanced <p> tags in JavaDocs. 2019-04-28 13:48:37 +02:00
Matthew Leon
1ad473ba49 LegacyAddressTest: Eliminate redundant 'throws'. 2019-04-24 10:38:21 +02:00
Matthew Leon
7f72faed3e Transaction: Simplify error checking in verify(). 2019-04-23 12:03:33 +02:00
Matthew Leon
48cfd8c816 WalletTest: Fix two deprecated method invocations. 2019-04-23 11:54:21 +02:00
Matthew Leon
6378d3829d LegacyAddress: Update outdated JavaDoc reference.
It suggests using a deprecated method.
2019-04-23 09:51:55 +02:00
Jakob Janecek
f2e59611f1 Block: Access transactions via getter rather than directly through the field. 2019-04-22 17:03:31 +02:00
Matthew Leon
a5d38dd1c1 FilteredBlockAndPartialMerkleTreeTests: Use BitcoinSerializer.makeBlock() rather than the deprecated Block() constructor. 2019-04-20 15:10:12 +02:00
Premek
c5582c89e6 LegacyAddressTest: Fix copy-paste error. 2019-04-18 17:22:26 +02:00
Matthew Leon
b6c2b0946f TransactionOutput: Kill an unnecessary instance variable. 2019-04-18 16:49:03 +02:00
Sean Gilligan
7bfeff65f6 build.gradle: Use plugins block rather than 'apply plugin' statements. 2019-04-18 16:41:12 +02:00
Oscar Guindzberg
26b30994b8 Wallet: Rename addScriptChangeEventListener() to addScriptsChangeEventListener() and removeScriptChangeEventListener() to removeScriptsChangeEventListener(), for the sake of naming consistency.
This renames related class fields too.
2019-04-17 18:51:33 +02:00
Matthew Leon
73ddffb38f Script: Ensure that non-canonical sigs result in script failure. 2019-04-17 16:17:02 +02:00
Oscar Guindzberg
a1a1f71a27 DeterministicKeyChainTest: Fix path constant name.
Use BIP44_COIN_1_ACCOUNT_ZERO_PATH instead of BIP44_ACCOUNT_ONE_PATH.
2019-04-16 10:02:23 +02:00
Oscar Guindzberg
98cff1d5b8 WalletAppKit: Remove redundant throws declaration. 2019-04-15 19:49:32 -03:00
Andreas Schildbach
d686d74903 Peer: Ignore incoming SendHeaders messages, because we don't announce new blocks. 2019-04-14 20:34:10 +02:00
Jakob Janecek
a00f751a56 Replace use of Utils.currentTimeMillis() with Utils.currentTimeSeconds() where appropriate. 2019-04-14 19:18:16 +02:00
Oscar Guindzberg
66289d6f39 WalletAppKit: Remove unnecessary call to KeyChainGroup.Builder.build(). 2019-04-13 02:18:38 +02:00
Oscar Guindzberg
0af0439b3f Wallet: Fix script type in deprecated findKeyFromPubHash(). 2019-04-11 18:36:14 +02:00
Andreas Schildbach
8a19bc14e6 KeyCrypterScryptTest: Fix spurious test failure in testKeyCrypterWrongPassword(). 2019-04-09 12:36:38 +02:00
Sean Gilligan
783dd45c4b Wallet: Remove (or reduce visibility of) the deprecated constructors.
Replace usages in unit tests and examples with usage of the static createDeterministic() constructor.
2019-04-08 11:23:41 +02:00
Andreas Schildbach
fbd63a24a0 ECKeyTest: Simplify testEncryptionIsReversible(). 2019-04-06 10:33:20 +02:00
Andreas Schildbach
1985c007b3 ECKey: Decrypted keys must always be 32 bytes long, otherwise likely the encryption key was wrong. 2019-04-06 10:32:05 +02:00
Matthew Leon
59060e91d2 ECKey: Add missing @Nullable on toString(). 2019-04-05 12:58:29 +02:00
Matthew Leon
ac37ed4087 Transaction: Add missing @Nullable on getMemo(). 2019-04-05 12:51:35 +02:00
Sean Gilligan
98c5e42517 build.gradle: Declare Automatic-Module-Name entry in MANIFEST.MF to make bitcoinj-core compatible to Java9 modules. 2019-04-05 11:45:52 +02:00
Sean Gilligan
170cc80e45 Update Guava to 27.1-android. 2019-04-05 10:31:35 +02:00
Matthew Leon
59a6407e68 KeyChainGroup: Fix NullPointerExceptions in decrypt() for the case of only a basic keychain. 2019-04-02 10:40:04 +02:00
Andreas Schildbach
8718a51c55 DefaultRiskAnalysisTest: Don't subclass Wallet. 2019-04-01 12:31:50 +02:00
Sean Gilligan
6c4ad41bce BaseTaggableObject: Simplify.
* Make the tags member non-nullable and final by initializing it
* Remove comment about being lazily-created (it doesn’t need to be)
* Remove now unnecessary null-handling code
* Eliminate dependency on Guava (Maps.newHashMap())
2019-04-01 12:08:04 +02:00
Matthew Leon
57de578707 PeerGroup.triggerConnectionsJob: Fix NullPointerException if inactives contains only IPv6 addresses. 2019-04-01 11:30:09 +02:00