3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-16 04:05:50 +00:00

654 Commits

Author SHA1 Message Date
Mike Hearn
535c2852ea TransactionBroadcast: invoke the progress listener if the broadcast already started, to avoid people accidentally writing races when using the PeerGroup convenience APIs. 2015-04-23 14:57:38 +02:00
Mike Hearn
acfc046a08 Wallet extensions: log errors when deserializing a non-mandatory extension and remove it from the wallet if deserialization throws. 2015-04-22 14:53:10 +02:00
Mike Hearn
82a0ddd4de Wallet: Provide new balance types to calculate balances excluding watching outputs. This is useful for wallets where transactions have been manually added and thus there is a mix of watching and non-watching transactions. The "new in 0.13" behaviour that getBalance(AVAILABLE) includes unspendable outputs is preserved, so the more typical approach of having a watching wallet and calling getBalance() still does what you expect and reports the balance of the watched wallet.
API change: send completion would previously include watched outputs and could therefore throw MissingPrivateKeyException. This has now changed so watched outputs won't be considered and thus the exception may change to be InsufficientMoneyException, unless completing a pre-prepared transaction that is already connected to watched outputs.
2015-04-21 13:01:29 +02:00
Andreas Schildbach
ed6821ed15 Add Wallet.isWatching() to determine if the wallet is a watching wallet. Comes with tests. 2015-04-21 13:01:29 +02:00
Mike Hearn
1e6ce4b1ba Rename DeterministicKey.getPubOnly() to dropPrivateBytes() to reflect what it's actually trying to do, and add dropParent() as well for the cases where we actually need a truly privkey-lacking object. Update the call sites to do whatever is appropriate for those situations. 2015-04-21 13:01:28 +02:00
Andreas Schildbach
a1612b0a8f Implement DeterministicKey.isPubKeyOnly(). The super-implementation in ECKey doesn't take possible rederivation into account. 2015-04-21 13:01:28 +02:00
Mike Hearn
d46ba33343 Add a LevelDB/JNI based SPV block store that records all headers. 2015-04-08 18:30:21 +02:00
Mike Hearn
c426e34646 Bug fix: don't pointlessly download a transaction we already have because we're broadcasting it.
This is a regression caused by the TxConfidenceTable rewrite: previously it pinned entire transactions and that was used to notice that a broadcast was happening. Now it only pins confidence objects. So instead we use the confidence.source property: if it's SELF then we assume we have it somewhere in the address space and don't bother downloading it when a peer announces it. If it's UNKNOWN then PeerGroup.broadcastTransaction will set it to SELF.
2015-04-07 15:37:22 +02:00
Mike Hearn
b5994e3788 A bit of unit test cleanup. 2015-04-06 16:34:59 +02:00
Mike Hearn
7576a44ef4 getutxo: Bugfixes identified by static analysis 2015-04-06 15:32:02 +02:00
Mike Hearn
037ec5aef9 getutxo: Flesh out the JavaDocs, link to the BIP, include brief security discussion, and make Peer support multiple in flight queries at once. 2015-04-06 15:14:31 +02:00
Mike Hearn
4c12127501 Context: add c'tors that take a context to [Abstract/FullPruned/]BlockChain and PeerGroup. The existing c'tors now do a consistency check against the existing context or create a new one on the fly. 2015-04-05 19:52:58 +02:00
Mike Hearn
c5123a320e Create context for WalletProtobufSerializerTest. 2015-03-22 16:48:57 +01:00
Mike Hearn
1a70f05ca7 Add a notion of an event horizon to the context. This is intended to unify the various places in the library where we want to throw data away after a tx is buried so deep it will probably never be re-orged, but which presently use different constants. The wallet will use the event horizon in future as well. 2015-03-21 17:07:44 +01:00
Mike Hearn
aae60d8391 Add NetworkParameters to the Context, and verify consistency when a context is fetched.
Make Wallet accept Context as a c'tor parameter and then update unit tests (which switch params very often) to create contexts when necessary.
2015-03-21 17:07:44 +01:00
Mike Hearn
95dec1a910 Don't run event listener twice if a peer announces twice. 2015-03-21 17:07:44 +01:00
Mike Hearn
750f469bd3 Confidence objects now pin themselves when a listener is attached, eliminating a certain class of GC-triggered heisenbug. 2015-03-21 17:07:44 +01:00
Mike Hearn
04bc624a91 Rewrite TxConfidenceTable to actually track confidence objects. Make Transaction.getConfidence() fetch the object from the table via the context. This allows us to simplify large chunks of code quite considerably. Note that confidence listeners are not yet pinning the attached confidence to the root set, so the same old bugs remain if you don't pin the tx object. That will be fixed next. 2015-03-21 17:07:44 +01:00
Mike Hearn
257aacf81b Make the Context object be a global object that is propagated between threads, and created on demand in the PeerGroup constructor. This isn't complete but is a sketch of where we might go. Context propagation is mostly auto-magical at the moment and will become less so with time, making it easier to use multiple instances of the library from the same thread simultaneously. At the moment you would potentially hit issues if using multiple instances from the same thread though and we should fix that before landing (aka don't break devrandom). 2015-03-21 17:07:43 +01:00
Mike Hearn
596d6f9d88 Wallet: optimise Bloom filter calculation some more, optimize calculateSpendCandidates, make watching wallets report the balance via getBalance instead of a different method. 2015-03-21 17:02:24 +01:00
Mike Hearn
40ee90cc0c Wallet: track UTXOs explicitly and use that to try and accelerate Bloom filtering for large wallets. 2015-03-21 17:02:24 +01:00
Andreas Schildbach
9e4d25b2c2 Properly ignore PeerGroupTest.peerPriority(). 2015-03-12 10:58:38 +01:00
Mike Hearn
3e1f615853 Correct a comment in ChainSplitTest 2015-03-10 18:48:37 -07:00
Mike Hearn
3116b612bd Disable flaky PeerGroup.peerPriority test pending a rewrite of it to be less flaky. 2015-03-10 17:07:17 -07:00
Mike Hearn
6aa4e51de6 Sha256Hash: some tweaks and renamings in the API (backwards compatible). 2015-03-05 13:59:15 -08:00
Mike Hearn
8e75134932 ChannelConnectionTest: Delete unused field. 2015-03-01 21:24:21 +01:00
Mike Hearn
bef4980abd (API CHANGE) Return a TransactionBroadcast object from PeerGroup.broadcastTransaction.
Old code can be updated by simply calling future() on the returned object to get the previous result.

TransactionBroadcast now has a progress reporting interface, which is ideal for connection to progress bars, pie charts, whatever else you want to use in the UI for showing the progress of sending money/broadcasting a tx.
2015-02-20 15:01:54 +01:00
Adam Mackler
7ef5ab9abf Don't discard hierarchy data when deserializing an HD key.
Fingerprints are now ints rather than four-byte arrays.
2015-02-18 12:42:50 +01:00
Mike Hearn
1efa1442c8 (API CHANGE) Pass the FilteredBlock into PeerEventListener.onBlocksDownloaded when present.
Keep track of downloaded vs server-side filtered transactions per second.
Add a keyboard shortcut to wallet-template to force disconnection from the current peer.
2015-02-17 17:02:57 +01:00
Mike Hearn
b2c1aba4d6 PeerGroup: sync improvements round two. Move chain download speed monitoring out of AbstractBlockChain and fix it so it doesn't sometimes print garbage. Add a stall detector. Next step is to force switch download peers when there's a long enough stall. 2015-02-16 18:11:46 +01:00
Sean Gilligan
c72c48cd58 Add Comparable to VersionedChecksummedBytes
* Add Comparable interface to VersionedChecksummedBytes
* Add compareTo() method to VersionedChecksummedBytes
* Add test for VersionedChecksummedBytes
* Add tests for Address
2015-02-03 00:15:25 +01:00
Mike Hearn
bc60f0d1f2 TransactionBroadcast: only consider a tx rejected if it has more than half peers signalling a reject. 2015-01-29 19:24:02 +01:00
Mike Hearn
fd10654143 Fix wallet tests that were using 1 as a private key. 2015-01-28 18:34:27 +01:00
Sean Gilligan
3456e896ec Make Address (& super & subs) Cloneable
* Implement Cloneable in VersionedChecksummedBytes
* Override clone() in VersionedChecksummedBytes
* Override clone() in Address
* Add Unit test file for VersionedChecksummedBytes
* Add clone unit tests for clone for all subclasses
   of VersionedChecksummedBytes

TODO: Consider overriding clone() in DumpedPrivateKey and
      BIP38PrivateKey
2015-01-16 19:54:22 +01:00
Oscar Guindzberg
336b0f6aa2 Fix typo 2015-01-16 11:32:05 -03:00
Mike Hearn
11463e729f Add a feature to PeerGroup that lets you find/wait for peers that match a certain mask, similar to those methods that exist for peer versions. 2015-01-09 15:17:56 +01:00
Andreas Schildbach
2fa5ba30e2 DefaultRiskAnalysis.isStandard checks for signatures to use canonical DER encoding. Adds a test. 2015-01-02 21:00:11 +01:00
Andreas Schildbach
17071ce15c Extract ECDSASignature.isCanonical() which checks for BIP62 low S value. Adds a test. 2015-01-02 17:29:17 +01:00
Andreas Schildbach
89c53a8f8e Add Wallet.fromKeys(). Creates a wallet containing a given set of keys. All further keys will be derived from the oldest key. 2014-12-18 13:32:24 +01:00
Mike Hearn
9025a65334 Block tester: Bring back UTXO rules when the local node supports them 2014-12-17 01:23:46 +01:00
Wojciech Langiewicz
bc24661254 Fix for issue 539, adds atomic operation for changing wallet encryption key/password. 2014-12-13 14:49:37 +01:00
Andreas Schildbach
4e313661df Add isPubKeyOnly and isEncrypted to both ECKey.toString() and DeterministicKey.toString(). 2014-12-11 23:09:10 +01:00
Andreas Schildbach
b2526f0b4d Throw when trying to set creation time of a DeterministicKey that is a leaf in the hierarchy. It would be needlessly stored, but unreadable. 2014-12-11 23:08:24 +01:00
Mike Hearn
b3c761388f Fix build, somehow this didn't show up before. 2014-12-08 22:13:40 +01:00
Mike Hearn
40c4338aaa Some fixes for crashes that could occur with a chain-less PeerGroup post-TxConfidenceTable changes. 2014-12-08 22:10:48 +01:00
Mike Hearn
757e25ba9b Wallet: fix a bug that could cause a temporarily corrupted balance, when two pending transactions arrive backwards 2014-12-04 17:09:53 +01:00
Devrandom
1ba568e069 rename TxConfidencePool to TxConfidenceTable 2014-12-03 13:10:07 +01:00
Devrandom
bc3a5cd845 introduce a Context object vended by AbstractBlockChain
have it hold the confidencePool
2014-12-03 13:10:06 +01:00
Devrandom
beb6f0873f Mark unrelated flaky test 2014-12-03 13:10:06 +01:00
Devrandom
b9bca58f26 Remove tx from TransactionConfidence 2014-12-03 13:10:06 +01:00