Andrew Poelstra
1938959017
Add `genesis_hash` function to Blockchain
2014-07-28 12:30:45 -07:00
Andrew Poelstra
6f7e73d6b4
Fix nu_select! macro for borrowck
2014-07-26 19:36:38 -07:00
Andrew Poelstra
322c937c3c
Fixed borrowck problems with nu_select! in an evil way
2014-07-26 11:28:55 -07:00
Andrew Poelstra
b5b7a6b080
Another workaround for https://github.com/rust-lang/rust/issues/15763
2014-07-25 16:50:58 -07:00
Andrew Poelstra
cc942a47f3
Workaround for rustc hiccup in `for` loop restructuring, remove assert from deserialization code
...
Thanks to the assert change there is a segfault happening :(
2014-07-25 15:52:48 -07:00
Andrew Poelstra
128ebcc6d5
Fix comment in UTXOset for stxo cache ordering
2014-07-25 14:35:46 -07:00
Andrew Poelstra
44dc29f013
Fix BIP30 rewind handling; add unsafe annotations to ThinVec::reserve
2014-07-25 12:44:54 -07:00
Andrew Poelstra
fe9ca39736
Send new handshake on reconnect
2014-07-24 12:52:28 -07:00
Andrew Poelstra
809bad5ff5
Reconnect on network errors; use Mutexes to control Socket access more precisely
2014-07-24 08:27:40 -07:00
Andrew Poelstra
9be493eeaf
Move Local::take() into a scope where it is guaranteed to be used
...
This was causing a mystery crash. Fixed.
2014-07-23 15:19:44 -07:00
Andrew Poelstra
1be45395da
Store TxOuts directly in UtxoSet rather than in Boxes
...
This gives a significant speedup during deserialization since we
don't have to allocate for every output.
2014-07-23 11:27:03 -07:00
Andrew Poelstra
b5c25ff768
Distinguish between network/decode errors in network message decode
...
It is now visible that EOF (i.e. peer hung up) is interpreted
as a message decode error. Probably what we want to do is reset
the connection on any error. TODO
2014-07-23 11:22:35 -07:00
Andrew Poelstra
9cb86dd21b
Change InvalidInput to EndOfFile in several cases
2014-07-22 10:59:58 -07:00
Andrew Poelstra
ca6d4cdde4
Workaround for https://github.com/rust-lang/rust/issues/15763
2014-07-21 19:40:29 -07:00
Andrew Poelstra
46969b3396
Replace PatriciaTree with HashMap for UTXO set
...
We get a speed up (~5%) and memory savings (~10%) on initial sync from
using a HashMap, though it's hard to tell precisely how much savings
because it's quite nonlinear.
I haven't tested de/serialization. Some work needs to be done there to
split up the UTXO set since it takes forever to saveload.
2014-07-20 16:52:00 -07:00
Andrew Poelstra
54e4ea4586
Rename Serializable::hash() to Serializable::bitcoin_hash()
...
We were conflicting with the Rust stdlib trait Hash, which is used
by various datastructures which need a general hash. Also implement
Hash for Sha256dHash so that we can use bitcoin hashes as keys for
such data structures.
2014-07-19 16:11:55 -07:00
Andrew Poelstra
a3846965e3
blockchain: replace Rc mess with internal raw pointers
2014-07-19 15:23:04 -07:00
Andrew Poelstra
93dadd6a6e
Add iterators to patricia tree
2014-07-19 13:02:25 -07:00
Andrew Poelstra
73e8b542c0
Add testnet blockspacing rule
2014-07-18 16:41:09 -07:00
Andrew Poelstra
51038f5810
Add alternate network support to `Blockchain`, `UtxoSet`, `Socket`
...
Still need to do alternate diffchange rules..
2014-07-18 14:38:35 -07:00
Andrew Poelstra
8f826a959d
Introduce `BitcoinResult`, use it instead of boolean returns in blockchain
2014-07-18 12:40:04 -07:00
Andrew Poelstra
b5fd47b334
Allow user to change network magic, add constant for testnet
...
We need to add a "difficulty back to 1 after 20 minutes" difficulty
rule to actually support testnet, but this is a start.
2014-07-18 12:03:38 -07:00
Andrew Poelstra
c9ad7c0b58
Initial commit, move into Cargo
2014-07-18 06:56:17 -07:00