Commit Graph

135 Commits

Author SHA1 Message Date
Dave Collins
c28c6e7636 Correct blog link in README.md. 2013-10-05 02:51:12 -05:00
Dave Collins
19a238825b Fix typo in README.md 2013-10-05 02:48:03 -05:00
Dave Collins
4864298884 Update README. 2013-10-04 23:02:00 -05:00
Dave Collins
9197342df0 Add deps.txt to track all deps used per release. 2013-10-04 16:03:50 -05:00
Dave Collins
168ff0e129 Bump version to 0.3.0. 2013-10-04 14:29:37 -05:00
Dave Collins
bba9fed133 Accepted transactions should log at debug level. 2013-10-04 14:16:57 -05:00
Dave Collins
efb54784c8 Log rejected blocks and transactions as info.
Rather than logging these as warnings which implies something is wrong
that might require user action, log them as info.
2013-10-04 13:35:28 -05:00
Dave Collins
223d146a10 Improve logging of rejected transactions.
Rather than showing all errors from ProcessTransaction as a failure, check
if the error is a TxRuleError meaning the transaction was rejected as
opposed to something actually going wrong and log it accordingly.
2013-10-04 13:33:54 -05:00
Dave Collins
83ac359c51 Convert transaction pool errors to their own type.
This allows the caller to distinguish if the error is because of a rule
violation or due to something actually going wrong.
2013-10-04 13:30:50 -05:00
Dave Collins
78b555fcf9 Improve logging of rejected blocks.
Rather than showing all errors from ProcessBlock as a failure, check if
the error is a RuleError meaning the block was rejected as opposed to
something actually going wrong and log it accordingly.
2013-10-04 13:13:16 -05:00
Dave Collins
c3a17de326 Comment Connected function in peer.
While here, also rearrange the functions slightly to logically group them.
2013-10-04 10:45:21 -05:00
Dave Collins
689c699bc5 Add a new findcheckpoint utility.
This utility is useful to programatically identify checkpoint candidates
which a developer can then do a more in-depth analysis on to choose an
appropriate checkpoint.
2013-10-04 10:12:24 -05:00
Dave Collins
905715e830 Update LICENSE to ISC on new utils. 2013-10-04 10:11:38 -05:00
Dave Collins
fd4b63073f Go fmt new utils. 2013-10-04 10:09:15 -05:00
Owain G. Ainsworth
96b92552b9 Can't use Connected() in Disconnect since it just set disconnected.
Use p.connected directly. This restores the correct disconnection of peers when
we go over the limit. Found by dhill, fix by me.
2013-10-04 15:05:31 +01:00
Dale Rahn
7659a134c9 Add new tool to rewind the database to a specific height or sha
Initial code for a block show/dump tool.

Initial code for a simple block inserter.
2013-10-04 09:33:56 -04:00
Dale Rahn
a10da1ed6c Update btcd for btcdb API change.
Rearrange code to pull out last tx as was previously expected.
2013-10-04 09:23:48 -04:00
Dave Collins
6ff9d152ca Update the sample config file.
This commit adds a few more available options to the sample config file
and clarifies a few things.
2013-10-04 01:38:41 -05:00
Dave Collins
8364392037 Remove SeedPeer option as it's not implemented. 2013-10-04 00:46:03 -05:00
Dave Collins
1db523883e Add missing format specifier in mempool.go.
Found by go vet.
2013-10-04 00:38:33 -05:00
Dave Collins
f983b0846e Add missing format specific in addrmanager.
Found by go vet.
2013-10-04 00:37:15 -05:00
Dave Collins
47c07ee5e1 Update a few comments. 2013-10-04 00:35:26 -05:00
Dave Collins
78e9b94d93 Implement transaction pool and relay.
This commit is a rather large one which implements transaction pool and
relay according to the protocol rules of the reference implementation.
It makes use of btcchain to ensure the transactions are valid for the
block chain and includes several stricter checks which determine if they
are "standard" or not before admitting them into the pool and relaying
them.

There are still a few TODOs around the more strict rules which determine
which transactions are willing to be mined, but the core checks which
are imperative (everything except the all of the "standard" checks really)
to operate as a good citizen on the bitcoin network are in place.
2013-10-03 22:31:54 -05:00
Dave Collins
3678153ae4 Allow regtest tool to be treated as a sync peer. 2013-10-03 22:31:00 -05:00
Owain G. Ainsworth
182c4d9ee6 Remove peers from duplicate map *before* we restart sync.
Just in case this ordering causes problems.
2013-10-03 20:13:56 +01:00
Owain G. Ainsworth
6bb0b80bbb Ignore non-sync invs and don't relay invs if we are not yet caught up.
We originally wanted to also not fetch orphan parents in this commit, however,
I have discovered that if you are doing a main sync from a peer, if it
sends you an orphan you must fetch it, else you ahven't fetched
everything it told you about and thus it will nto send you end more invs
from the main sync.

So we always fetch orphan parents, but we still don't fetch from
non-sync peers (all invs from them will be unsolicited). Seems to fix some hangs
with multiple peers.
2013-10-03 20:13:56 +01:00
Dave Collins
6dbc61e960 Remove the noverify option.
This was a development only option.
2013-10-03 13:01:18 -05:00
Dave Collins
0c6b79afb0 Don't disconnect on unrequested blocks for regtest.
The "official" regression test tool intentionally sends some unrequested
duplicate blocks to ensure the chain handling code does not fail when
trying to insert them.  This commit adds an exception to the block manager
which typically disconnects peers that send unrequested blocks (they are
misbehaving if they do this) for regression test mode.
2013-10-03 11:21:41 -05:00
Dave Collins
bd3a39ad4a Fix comment typo. 2013-10-03 11:10:57 -05:00
Owain G. Ainsworth
2b56e7a397 Don't need the blockpeermutex anymore.
Really, it would be nice to pass an interface{} into chain to be given
to us when the callback calls, it would avoid the awkward sidchanneling
through the map and should actually be more efffieint (pointer passing >
hashtable insert, lookup, then remove).
2013-10-03 16:13:47 +01:00
Dave Collins
c1b327c06a Make the signal handling concurrent safe. 2013-10-03 09:29:18 -05:00
John C. Vernaleo
35c95f0a36 Handle case where no auth is sent to rpcserver. 2013-10-03 08:12:18 -04:00
Dave Collins
fd0679acdd Update notification for recent btcchain API change. 2013-10-02 21:21:52 -05:00
Dave Collins
29dfa22086 Introduce a Stringer on peers.
Rather than having all of the various places that print peer figure out
the direction and form the string, centralize it by implementing the
Stringer interface on the peer.
2013-10-02 20:05:10 -05:00
Dave Collins
f1e2de4f0c Go fmt. 2013-10-02 19:44:07 -05:00
Dave Collins
52701d826d Add directionality back to remove peer log too. 2013-10-02 19:43:38 -05:00
Owain G. Ainsworth
13a8a8e7e3 use directionString() instead of handrollong. 2013-10-03 01:39:31 +01:00
Owain G. Ainsworth
2dcd003722 Print if a peer is inbound or outbound.
This got lost in the peer logging rework. Pointed out by davec@.
2013-10-03 01:21:30 +01:00
Owain G. Ainsworth
eb667fdf83 Remove races on chain.
Chain is not concurrency safe, so we move the chainNotifySink handling
into the main blockmanager goroutine. Due to a possible deadlock if the
buffer is filled this still has to be a single channel that isn't linked
to the other ones. There is a possible starvation issue where the main
msgChan gets selected more often than the  notification sink, but until
chain is concurrency safe this is rather unavoidable.
2013-10-03 00:50:36 +01:00
Owain G. Ainsworth
8974e789f7 Convert the rest of the subsystems to use atomics for shutdown vars. 2013-10-03 00:33:42 +01:00
Owain G. Ainsworth
f333cb4220 Remove a (largely harmless) race on p.conn
Add a Connected() member function that checks atomic variables to see if
the peer is connected.
2013-10-02 23:06:29 +01:00
Owain G. Ainsworth
5c1340be8f make logging about peers rather quieter.
Only log errors for most cases if the peer is persisent (and thus requested).
Only log by default after version exchange, and after losing a peer that had
completed version exchange. Make most other messages debug.
2013-10-02 22:50:24 +01:00
David Hill
0cf8601169 add tests for RFC*, Local, Valid, and Routable. 2013-10-02 17:34:25 -04:00
David Hill
6f9aada482 RFC4193 is fc00::/7, not fc00::/15. Also fix two typos in RFC4843()
and RFC6052
2013-10-02 17:31:44 -04:00
Owain G. Ainsworth
71ea6700a2 Hold amgr lock in {load,save}Peers.
We're traversing internal datastructures here.
2013-10-02 20:37:42 +01:00
Owain G. Ainsworth
70f15f434f Return nil in GetAddress if no addresses present.
Honestly thought we already did this, but turns out no.
2013-10-02 20:19:47 +01:00
Dave Collins
ad12d10503 Remove unused wakeup timer in peerHandler. 2013-10-02 13:52:44 -05:00
Owain G. Ainsworth
7d24f31fbd lack of a peers.json isn't an error, don't log in that case. 2013-10-02 15:25:43 +01:00
Owain G. Ainsworth
4455e77dde Don't create additional outbound peers if any --connect are specified. 2013-10-02 15:16:04 +01:00
Owain G. Ainsworth
98109dbadd Fix shutdown hangs.
We would occasionally hang or a while during server shudown, this is due
to an outbound peer waiting on a connection or a sleep. However, we
don't actually require to wait for the peers to finish at all. So just
let them finish.

Secondly, make peer.disconnnect and server.shutdown atomic varaibles so
that checking them from multiple goroutines isn't race, and clean up
their usage.
2013-10-02 14:36:04 +01:00