MultiChain / multichain

Source code for multichaind, multichain-cli and multichain-util.
GNU General Public License v3.0
536 stars 259 forks source link

Segmentation fault #76

Closed kf106 closed 6 years ago

kf106 commented 6 years ago

Error:

MultiChain 2.0 alpha 5 Daemon (latest protocol 20004)

Retrieving blockchain parameters from the seed node frogchain.multidasher.org:8882 ...
Other nodes can connect to this node using:
multichaind frogchain@192.168.8.104:8882

Listening for API requests on port 8881 (local only - see rpcallowip setting)

Node ready.

Segmentation fault (core dumped)

OS: Ubuntu 18.04

Version: Multichain 2.0.5

Params.dat file:

# ==== MultiChain configuration file ====

# Created by multichain-util 
# Protocol version: 20004 

# This parameter set is VALID. 
# To join network please run "multichaind frogchain".

# The following parameters can only be edited if this file is a prototype of another configuration file. 
# Please run "multichain-util clone frogchain <new-network-name>" to generate new network. 

# Basic chain parameters

chain-protocol = multichain             # Chain protocol: multichain (permissions, native assets) or bitcoin
chain-description = Drupal plus Blockchain FTW! # Chain description, embedded in genesis block coinbase, max 90 chars.
root-stream-name = root                 # Root stream name, blank means no root stream.
root-stream-open = true                 # Allow anyone to publish in root stream
chain-is-testnet = false                # Content of the 'testnet' field of API responses, for compatibility.
target-block-time = 60                  # Target time between blocks (transaction confirmation delay), seconds. (2 - 86400)
maximum-block-size = 8388608            # Maximum block size in bytes. (5000 - 1000000000)
maximum-chunk-size = 1048576            # Maximum chunk size for off-chain items in bytes. (256 - 16777216)
maximum-chunk-count = 1024              # Maximum number of chunks in one off-chain item. (16 - 2048)

# Global permissions

anyone-can-connect = true               # Anyone can connect, i.e. a publicly readable blockchain.
anyone-can-send = true                  # Anyone can send, i.e. transaction signing not restricted by address.
anyone-can-receive = true               # Anyone can receive, i.e. transaction outputs not restricted by address.
anyone-can-receive-empty = true         # Anyone can receive empty output, i.e. without permission grants, asset transfers and zero native currency.
anyone-can-create = false               # Anyone can create new streams.
anyone-can-issue = false                # Anyone can issue new native assets.
anyone-can-mine = false                 # Anyone can mine blocks (confirm transactions).
anyone-can-activate = false             # Anyone can grant or revoke connect, send and receive permissions.
anyone-can-admin = false                # Anyone can grant or revoke all permissions.
support-miner-precheck = true           # Require special metadata output with cached scriptPubKey for input, to support advanced miner checks.
allow-arbitrary-outputs = false         # Allow arbitrary (without clear destination) scripts.
allow-p2sh-outputs = true               # Allow pay-to-scripthash (P2SH) scripts, often used for multisig. Ignored if allow-arbitrary-outputs=true.
allow-multisig-outputs = true           # Allow bare multisignature scripts, rarely used but still supported. Ignored if allow-arbitrary-outputs=true.

# Consensus requirements

setup-first-blocks = 30                 # Length of initial setup phase in blocks, in which mining-diversity,
                                        # admin-consensus-* and mining-requires-peers are not applied. (1 - 31536000)
mining-diversity = 0.3                  # Miners must wait <mining-diversity>*<active miners> between blocks. (0 - 1)
admin-consensus-upgrade = 0.5           # <admin-consensus-upgrade>*<active admins> needed to upgrade the chain. (0 - 1)
admin-consensus-txfilter = 0.5          # <admin-consensus-txfilter>*<active admins> needed to approve filter in the chain. (0 - 1)
admin-consensus-admin = 0.5             # <admin-consensus-admin>*<active admins> needed to change admin perms. (0 - 1)
admin-consensus-activate = 0.5          # <admin-consensus-activate>*<active admins> to change activate perms. (0 - 1)
admin-consensus-mine = 0.5              # <admin-consensus-mine>*<active admins> to change mining permissions. (0 - 1)
admin-consensus-create = 0.0            # <admin-consensus-create>*<active admins> to change create permissions. (0 - 1)
admin-consensus-issue = 0.0             # <admin-consensus-issue>*<active admins> to change issue permissions. (0 - 1)

# Defaults for node runtime parameters

lock-admin-mine-rounds = 10             # Ignore forks that reverse changes in admin or mine permissions after this many mining rounds have passed. Integer only. (0 - 10000)
mining-requires-peers = true            # Nodes only mine blocks if connected to other nodes (ignored if only one permitted miner).
mine-empty-rounds = 10                  # Mine this many rounds of empty blocks before pausing to wait for new transactions. If negative, continue indefinitely (ignored if target-adjust-freq>0). Non-integer allowed. (-1 - 1000)
mining-turnover = 0.5                   # Prefer pure round robin between a subset of active miners to minimize forks (0.0) or random equal participation for all permitted miners (1.0). (0 - 1)

# Native blockchain currency (likely not required)

initial-block-reward = 64               # Initial block mining reward in raw native currency units. (0 - 1000000000000000000)
first-block-reward = 5000000            # Different mining reward for first block only, ignored if negative. (-1 - 1000000000000000000)
reward-halving-interval = 1051200       # Interval for halving of mining rewards, in blocks. (60 - 1000000000)
reward-spendable-delay = 60             # Delay before mining reward can be spent, in blocks. (1 - 100000)
minimum-per-output = 0                  # Minimum native currency per output (anti-dust), in raw units.
                                        # If set to -1, this is calculated from minimum-relay-fee. (-1 - 1000000000)
maximum-per-output = 100000000000000    # Maximum native currency per output, in raw units. (0 - 1000000000000000000)
minimum-offchain-fee = 0                # Minimum fee for publishing off-chain data items, per 1000 bytes, in raw units of native currency. (0 - 1000000000)
minimum-relay-fee = 0                   # Minimum transaction fee, per 1000 bytes, in raw units of native currency. (0 - 1000000000)
native-currency-multiple = 1000000      # Number of raw units of native currency per display unit. (0 - 1000000000)

# Advanced mining parameters

skip-pow-check = false                  # Skip checking whether block hashes demonstrate proof of work.
pow-minimum-bits = 8                    # Initial and minimum proof of work difficulty, in leading zero bits. (1 - 32)
target-adjust-freq = -1                 # Interval between proof of work difficulty adjustments, in seconds, if negative - never adjusted. (-1 - 4294967295)
allow-min-difficulty-blocks = false     # Allow lower difficulty blocks if none after 2*<target-block-time>.

# Standard transaction definitions

only-accept-std-txs = true              # Only accept and relay transactions which qualify as 'standard'.
max-std-tx-size = 4194304               # Maximum size of standard transactions, in bytes. (1024 - 100000000)
max-std-op-returns-count = 32           # Maximum number of OP_RETURN metadata outputs in standard transactions. (0 - 1024)
max-std-op-return-size = 2097152        # Maximum size of OP_RETURN metadata in standard transactions, in bytes. (0 - 67108864)
max-std-op-drops-count = 5              # Maximum number of OP_DROPs per output in standard transactions. (0 - 100)
max-std-element-size = 40000            # Maximum size of data elements in standard transactions, in bytes. (128 - 80000)

# The following parameters were generated by multichain-util.
# They SHOULD ONLY BE EDITED IF YOU KNOW WHAT YOU ARE DOING. 

default-network-port = 8882             # Default TCP/IP port for peer-to-peer connection with other nodes.
default-rpc-port = 8881                 # Default TCP/IP port for incoming JSON-RPC API requests.
chain-name = frogchain                  # Chain name, used as first argument for multichaind and multichain-cli.
protocol-version = 20004                # Protocol version at the moment of blockchain genesis.
network-message-start = f40970ad        # Magic value sent as the first 4 bytes of every peer-to-peer message.
address-pubkeyhash-version = 003336cf   # Version bytes used for pay-to-pubkeyhash addresses.
address-scripthash-version = 05ab711b   # Version bytes used for pay-to-scripthash addresses.
private-key-version = 80b016af          # Version bytes used for exporting private keys.
address-checksum-value = d45f27f8       # Bytes used for XOR in address checksum calculation.

# The following parameters were generated by multichaind.
# They SHOULD NOT BE EDITED. 

genesis-pubkey = 02da0ce4e279f432d7163d2b9241d6e1c31e5af2e969bc019477c53b33b9ed523f # Genesis block coinbase output public key.
genesis-version = 1                     # Genesis block version.
genesis-timestamp = 1539624963          # Genesis block timestamp.
genesis-nbits = 536936447               # Genesis block difficulty (nBits).
genesis-nonce = 140                     # Genesis block nonce.
genesis-pubkey-hash = e4043e4b65f2a263d12b3e0f619f05dc4e9cbfb1 # Genesis block coinbase output public key hash.
genesis-hash = 000cc30c163fe3b18d8bf4e4eab574689705b7cf3f81db9ae556263b10818692 # Genesis block hash.
chain-params-hash = 2f735951174ab2b9cd1c9e597d4e0d296a4c50c9dba9f554723b0f5d4642e19f # Hash of blockchain parameters, to prevent accidental changes.

Notes: Chain contains a native currency, and has anyone-can-connect/send/receive set to true.

multichain-cli frogchain getinfo returns: error: couldn't connect to server

Node was started with multichaind frogchain i.e. not as a daemon.

Running the command again didn't give a segmentation fault.

gidgreen commented 6 years ago

Thanks. If you stop the node and remove the blockchain directory, then connect again as if it had never seen the network before, does the segmentation fault occur reliably?

kf106 commented 6 years ago

I deleted the cloud instance that setup the node. I've tried to reproduce the error (I got it two time out of three with the first setup). However, I now have a suspicion of what might have happened:

keir@chainfrog-nitro:~/.multichain$ multichaind frogchain

MultiChain 2.0 alpha 5 Daemon (latest protocol 20004)

Chain frogchain already exists, adding f to list of peers

Other nodes can connect to this node using:
multichaind frogchain@192.168.8.104:8882

Listening for API requests on port 8881 (local only - see rpcallowip setting)

Node ready.

multichaind: pthread_create.c:430: start_thread: Assertion `freesize < pd->stackblock_size' failed.
Aborted (core dumped)
keir@chainfrog-nitro:~/.multichain$ multichaind frogchain@f

That last line is me hitting cursor-up. I recalled the first command (multichaind frogchain@frogchain.multidasher.org:8882) and backspaced to the @. At least, it looked like I had. But the terminal wasn't displaying correctly. So terminal fault rather than MultiChain fault.

I suspect this is the issue, so I'd put this on ice. If it happens again I'll be more thorough.

gidgreen commented 6 years ago

OK, that explains it, because this assertion is nowhere to be found in the MultiChain source code!