Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rustyrussell/pettycoin
base: 263534b8dceb
Choose a base ref
...
head repository: rustyrussell/pettycoin
compare: 297d09d31d7f
Choose a head ref
  • 20 commits
  • 70 files changed
  • 1 contributor

Commits on Sep 15, 2014

  1. recv_block: log block height when we get error.

    Usually it's UNKNOWN_PREV (ie. we're syncing); it's good to know what
    block we're up to.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    cbfe0ca View commit details
    Browse the repository at this point in the history
  2. peer: remove erroneous peers from the cache.

    We kept reconnecting to a peer when a bug caused a bad welcome.  Rename
    close_peer to close_bad_peer to make it really clear.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    59114ca View commit details
    Browse the repository at this point in the history
  3. peer: change peer port when they give is a listen port.

    This way we match the cache; the actual port they connected from is in
    the log prefix already.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    df2b2dc View commit details
    Browse the repository at this point in the history
  4. protocol: fix endian annotation on listen_port.

    We treat it as le16 everywhere, the definition is wrong.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    2b0d537 View commit details
    Browse the repository at this point in the history
  5. difficulty: more helper functions.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    4fb3d3e View commit details
    Browse the repository at this point in the history
  6. protocol: add multiple previous block hashes to block hash (BREAKS PR…

    …OTOCOL)
    
    Include the hashes of multiple previous blocks, not just the height-1
    block.
    
    The idea of such a structure (sometimes called an SPV skipchain) came
    from bitcoin discussions, but it's particularly powerful for coins
    with a horizon like pettycoin.
    
    It allows discarding of some most blocks while maintaining proof that
    work was done.  With a 10 second block time, we generate 3,153,600
    blocks a year: 3.2GB with 1k blocks.  Using the skipchain we can weed
    this down by a factor of 10 (more if we're lucky, a bit less if we're
    unlucky).
    
    I came across this idea in Mark Friedenbach's post on Compact SPV proofs:
      http://sourceforge.net/p/bitcoin/mailman/message/32111357/
    
    But he traces the original idea to Andrew Miller's "The High-Value-Hash
    Highway":
      https://bitcointalk.org/index.php?topic=98986.0
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    3888f64 View commit details
    Browse the repository at this point in the history
  7. protocol: check prev field on new blocks.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    81e87a1 View commit details
    Browse the repository at this point in the history
  8. protocol: fixed 8k interest bitmap (BREAKS PROTOCOL)

    Might as well spell it out; it's only 8k.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    d0b20ca View commit details
    Browse the repository at this point in the history
  9. Move detached block handing into its own file.

    We'll want this for syncing, too.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    ba1a944 View commit details
    Browse the repository at this point in the history
  10. recv_block: handle blocks which aren't inside protocol_pkt_block.

    We're going to change protocol_pkt_welcome to include a marshaled block,
    but all the code assumes a protocol_pkt_block.  Remove this assumption,
    though we still need to pass in the tal'ed ptr, so we can steal it.
    
    This lets us fix a wart in the submitblock JSON API, too: it doesn't
    need the protocol_pkt_block header any more.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    14fe8bb View commit details
    Browse the repository at this point in the history
  11. num_prevs() function.

    Helper to calculate how many (non-zero) previous hashes we have.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    57e47bc View commit details
    Browse the repository at this point in the history
  12. protocol: Make welcome include "best" block (BREAKS PROTOCOL)

    This approach is inspired by Gregory Maxwell's Reverse_header-fetching_sync:
    https://en.bitcoin.it/wiki/User:Gmaxwell/Reverse_header-fetching_sync
    
    It's made more powerful by the presence of multiple previous block
    pointers, so we can get much more parallelism.
    
    We don't currently compare results across different peers, so we could
    be lead down the garden path by some peer.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    93af978 View commit details
    Browse the repository at this point in the history
  13. pending: Remove incorrect comment, document weird behaviour.

    I noticed that after a json sendrawtransaction injection, the node
    was doing a PROTOCOL_PKT_GET_TX for transactions it already had.  This is
    because add_pending_tx() returns ECODE_INPUT_UNKNOWN as it doesn't look
    in the pending queue for inputs.
    
    It's a wart, but it's not a fatal flaw.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    fc3c883 View commit details
    Browse the repository at this point in the history
  14. recv_block: get as many ancestors as we can at once.

    This has the advantage that the queries can spread across multiple peers.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    c34b4d2 View commit details
    Browse the repository at this point in the history
  15. protocol: hash children for syncing (BREAKS PROTOCOL)

    This makes sure we've got the correct tree, rather than just using a
    counter.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    f5912be View commit details
    Browse the repository at this point in the history
  16. recv_block: calculate minimum possible difficulty.

    Using 1/16 of last block's difficulty is wrong for very old blocks:
    get more sophisticated by calculating minimum based on what we do
    know.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    ba2623f View commit details
    Browse the repository at this point in the history
  17. protocol: fix fee calculation (BREAKS PROTOCOL)

    We should charge 0.3% of the actual transferred amount (ie. not
    including change).
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    98e98b0 View commit details
    Browse the repository at this point in the history
  18. pettycoin-generate: don't need timestamp.o

    Use ccan/time directly, too.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    26616e5 View commit details
    Browse the repository at this point in the history
  19. Rename shard_nums to num_txs

    Simple renaming: it really is the number of transactions within
    each shard, so num_txs[] is clearer.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    070f983 View commit details
    Browse the repository at this point in the history
  20. block_info: structure to contain block on the wire.

    Since we're going to change it for merge mining, encapsulate it now to
    avoid massive refactor confusing the block structure.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 15, 2014
    Configuration menu
    Copy the full SHA
    297d09d View commit details
    Browse the repository at this point in the history