Commit graph

3486 commits

Author SHA1 Message Date
Dave Collins
50388bcf66 Add more mempool standard checks.
This commit adds a few more checks to restrict what transactions are
allowed into the transaction memory pool and therefore are candidates
to be mined and relayed.

In particular, the following changes were made to what is considered
standard:

- nulldata scripts are now supported and considered standard
- multi-signature transaction are now checked to ensure they only have a
  max of 3 pubkeys and the number of signatures doesn't exceed the number
  of pubkeys
- the number of inputs to a signature script must now match the expected
  number of inputs for the script type (includes support for additional
  pay-to-script-hash inputs)
- the number of inputs pushed onto the stack by a redeeming sig script
  must match the number of inputs consumed by the referenced pk script
- there can now only be a max of one nulldata output per transaction
2013-11-14 17:40:12 -06:00
Dave Collins
d4c5b3d04d Add tests for new nulldata standard script type. 2013-11-14 16:20:11 -06:00
Dave Collins
cfc2a4cc76 Add support for nulldata standard scripts.
This commit adds the new standard script type for empty, but data carrying
and provably prunable transaction scripts.

Closes #2.

ok @owainga
2013-11-14 16:20:02 -06:00
Dave Collins
c33bd15df2 Add a new func CalcMultiSigStats.
This commit adds a new function to extract the number of pulic keys and
number of signatures from a multi-signature script.

ok @owainga
2013-11-14 16:18:11 -06:00
Dave Collins
8550b11685 Fix missing comma. 2013-11-14 14:43:40 -06:00
Dave Collins
80e8c589d8 Bring back nonstand script class stringer test. 2013-11-14 14:42:44 -06:00
Dave Collins
e2770d3691 Go fmt. 2013-11-14 14:39:57 -06:00
Dave Collins
e3eca752da Allow verbose param on btcctl getrawtransaction. 2013-11-14 12:19:20 -06:00
Dave Collins
1ca389aa3d Go fmt. 2013-11-14 11:13:58 -06:00
Dave Collins
c3a3fbcabf Don't bother parsing listeners if disabled. 2013-11-13 21:16:49 -06:00
Dave Collins
3902a71bee Minor cleanup. 2013-11-13 21:12:41 -06:00
Dave Collins
ac375df71f Use the passed addresses in parseListeners.
Also, check the return error on parseListeners to catch invalid IP
addresses.
2013-11-13 21:02:34 -06:00
Dave Collins
50484c5841 Update sample config file with recent changes.
This commit updates the sample config file to add the new listen option
and update the semantics regarding the combination of --proxy and --tor
flags.
2013-11-13 20:20:32 -06:00
Dave Collins
7b86bec825 Comment new parseLiteners function. 2013-11-13 19:43:36 -06:00
Owain G. Ainsworth
6116a6cb02 Support --listen.
This allows the provision of address/port pairs to be listened on instead
of just providing the port. e.g.:
btcd --listen 1.2.3.4:4321 --listen 127.0.0.01 --listen [::1]:5432

When --proxy and --connect are used, we disable listening *unless* any --listen
arguments have been provided, when we will listen on those addresses as
requested.

Initial code by davec, integration by myself.

Closes #33

allow listens to fail, but warn. error if all failed

fmt
2013-11-14 01:15:47 +00:00
Dave Collins
3108b94401 Add 0.3.3 deps to deps.txt. 2013-11-13 10:53:57 -06:00
Dave Collins
58fdcec6e2 Prepare for release 0.3.3. 2013-11-13 10:52:14 -06:00
Owain G. Ainsworth
d20f958c92 Make parameters to VerifyChainCmd int32.
One is a blockheight (int32 pretty much by protocol definition, it
breaks at 1e8 in a long time) and the other is between 0 and 5.
2013-11-12 20:54:08 -06:00
Dave Collins
2300b35731 Add checkpoint at block height 267300. 2013-11-12 20:11:55 -06:00
Owain G. Ainsworth
31a97d5c09 look up tx in mempool first for getrawtransaction
Closes #26
2013-11-12 22:57:27 +00:00
Owain G. Ainsworth
bb276b53aa Add support for the verifychain command.
So far we only do level 0 and level 1 checks (precense and basic
sanity). The checks done at higher levels in bitcoind are closely
coupled with their database layout.

arguably Closes #13
2013-11-12 22:57:26 +00:00
John C. Vernaleo
94e74e7cc7 Increase test coverage for Cmd. 2013-11-12 16:33:58 -05:00
Josh Rickmar
31f27cffd5 Safely remove elements from list.Lists. 2013-11-12 16:24:32 -05:00
Josh Rickmar
afc520634f Process all tx notifications, then notify new block.
This change allows wallet to record all transactions in a block before
receving the new block notification, and then process them all
together when the blockconnected notification arrives.
2013-11-12 14:50:33 -05:00
John C. Vernaleo
d341468b87 Add a test that was missed. 2013-11-12 12:49:22 -05:00
Josh Rickmar
f689789be8 Fix parameter for GetNewAddressCmd.
The first parameter for a getnewaddress command is the account, not an
address, so name it properly in the GetNewAddressCmd struct.
2013-11-12 12:36:57 -05:00
Josh Rickmar
497f177044 Add frontend <-> wallet extension commands.
This change adds support for the following extension commands:
- createencryptedwallet
- getbalances
- walletislocked
2013-11-12 11:57:06 -05:00
Josh Rickmar
d3dea375c6 Fix SendManyCmd unmarshaling.
This change fixes an incorrect parameter length check, as well as
correcting the type assertions for the address to amount pairs.
2013-11-12 11:24:33 -05:00
Josh Rickmar
77e1af792b Fix mutex handling for removing minedtx requests.
Previously, RemoveMinedTxRequest was being run from a caller which
held a reader lock for the websocket request contexts.  When
RemoveMinedTxRequest tried to grab a writer lock, it would block.
This change creates a new function, removeMinedTxRequest, that does
not grab any locks, and the caller (NotifyBlockConnected) grabs a
writer lock instead of a reader lock.
2013-11-11 14:23:11 -05:00
Josh Rickmar
8b5413a4ac Always release ws context reader lock.
Previously, on a blockconnected notification, the websocket context
reader lock was not always being given up properly.  This change
defers the unlock so it will always happen.

This fixes an issue where wallet will stop responding (due to not
being able to complete its handshake) on reconnect.
2013-11-11 12:54:49 -05:00
Dave Collins
dcf2994905 Add some missed imports in last commit. 2013-11-11 11:52:59 -06:00
Dave Collins
89eae6f590 Update utilities to use new btcutil.AppDataDir.
Closes #30.
2013-11-11 10:58:39 -06:00
Dave Collins
72c186f9a9 Migrate to new app data directories.
This commit makes use of the new btcutil.AppDataDir function which chooses
appropriate data directories for each supported operating system.  It also
adds code to the upgrade path to properly migrate existing data from the
old to new locations.

This is part of work toward issue #30.
2013-11-11 10:58:38 -06:00
Josh Rickmar
38bebf2036 Fix another issue with a godoc comment. 2013-11-08 14:13:47 -05:00
Josh Rickmar
91b030cb76 Fix comments. 2013-11-08 14:07:57 -05:00
Josh Rickmar
0c37bf3b50 Marshal txmined notification results correctly. 2013-11-08 13:03:34 -05:00
Josh Rickmar
41838b83b0 Use btcws package for wallet notifications. 2013-11-08 12:44:00 -05:00
Josh Rickmar
3270be61fc go fmt 2013-11-08 12:42:32 -05:00
Josh Rickmar
f32b5692d5 Add btcd notification types and parser. 2013-11-08 12:41:04 -05:00
Dave Collins
d0bbcacfc0 Modify the tests to use memory database backend.
This commit modifies the tests to setup a chain instance backed by the new
memory database backend for btcdb.  This allows the tests to avoid
creating and cleaning up files and also allows the tests to run faster
since it can all happen in memory.

The chainSetup function has also been changed to provide logic to switch
on the database type to allow for easy changing of the backend to a
different database type as needed.  For example, it could be useful to
provide extra testing against new database backends.
2013-11-08 02:52:50 -06:00
Dave Collins
d226968472 Add a new memory database backend named memdb.
This commit adds a new backend driver which conforms to the btcdb
interface to provide a memory only database.  This is primarily useful for
testing purposes as normal operations require a persistent block storage
mechanism.
2013-11-08 02:48:59 -06:00
Dave Collins
ec70b6d1b3 Add comments which describe what is spent where. 2013-11-07 18:05:46 -06:00
Dale Rahn
e10cb732fd Fix. 2013-11-07 18:24:27 -05:00
Dave Collins
af311078b4 Correct btcctl getblockhash.
Also run gofmt while here.
2013-11-07 17:07:26 -06:00
Owain G. Ainsworth
d81a2c9067 Check for 0 shas before dereferencing list 2013-11-07 22:26:43 +00:00
Dave Collins
5295be070d Make the CheckBlockSanity function context free.
Rather than defining CheckBlockSanity as a member of a BlockChain
instance, define it at the root level so it is truly context free as
intended.  In order to make it context free, the proof of work limit is
now a required parameter.
2013-11-07 16:06:01 -06:00
Dave Collins
09b53a8fca Export the CheckBlockSanity function. 2013-11-07 15:39:48 -06:00
Josh Rickmar
ced24946a4 Rework JSON handlers to take a btcjson.Cmd.
This change reworks where the command parsing occurs to be done before
handlers are checked.  Before, the websocket extension handler called
the standard handler with the same message, and if it was unhandled,
would unmarshal it a second time for checking extension handlers.
2013-11-07 13:53:41 -05:00
Josh Rickmar
d403863e2b Don't marshal a function for getbestblockhash replies. 2013-11-07 13:53:22 -05:00
Owain G. Ainsworth
f4a6449ad3 Actually just fail the opcode, not returning an error.
should fix some crazy script on testnet.
2013-11-07 18:23:20 +00:00