diff --git a/bin/drk/src/rpc_wallet.rs b/bin/drk/src/rpc_wallet.rs index f8e5343dd..2189842e6 100644 --- a/bin/drk/src/rpc_wallet.rs +++ b/bin/drk/src/rpc_wallet.rs @@ -143,7 +143,7 @@ impl Drk { } else { format!( "SELECT * FROM {} WHERE {} = {}", - MONEY_COINS_TABLE, MONEY_COINS_COL_IS_SPENT, 0 + MONEY_COINS_TABLE, MONEY_COINS_COL_IS_SPENT, false, ) }; @@ -193,7 +193,8 @@ impl Drk { let coin_bytes: Vec = serde_json::from_value(row[0].clone())?; let coin: Coin = deserialize(&coin_bytes)?; - let is_spent: bool = serde_json::from_value(row[1].clone())?; + let is_spent: u64 = serde_json::from_value(row[1].clone())?; + let is_spent = if is_spent > 0 { true } else { false }; let serial_bytes: Vec = serde_json::from_value(row[2].clone())?; let serial: pallas::Base = deserialize(&serial_bytes)?; diff --git a/contrib/localnet/darkfid-temp/README.md b/contrib/localnet/darkfid-temp/README.md new file mode 100644 index 000000000..203eaf8ea --- /dev/null +++ b/contrib/localnet/darkfid-temp/README.md @@ -0,0 +1,32 @@ +Some notes +========== + +Start the nodes + +``` +$ ../../../faucetd -c ./faucetd.config -v +$ ../../../darkfid -v ./darkfid.config -v +``` + +Wait for them to start up, then initialize wallet: + +``` +$ ../../../drk -e tcp://127.0.0.1:18340 wallet --initialize +$ ../../../drk -e tcp://127.0.0.1:18340 wallet --keygen +``` + +Subscribe to new blocks + +``` +$ ../../../drk -e tcp://127.0.0.1:18340 subscribe +``` + +Airdrop some coins + +``` +$ ../../../drk -e tcp://127.0.0.1:18340 airdrop 42.69 A7f1RKsCUUHrSXA7a9ogmwg8p3bs6F47ggsW826HD4yd +``` + +Wait and look at the subscription. It gets the block correctly, but +it seems to see the transaction again in new incoming blocks. What's +happening? diff --git a/contrib/localnet/darkfid-temp/darkfid_config.toml b/contrib/localnet/darkfid-temp/darkfid_config.toml new file mode 100644 index 000000000..b6d5d9cd8 --- /dev/null +++ b/contrib/localnet/darkfid-temp/darkfid_config.toml @@ -0,0 +1,82 @@ +## darkfid configuration file +## +## Please make sure you go through all the settings so you can configure +## your daemon properly. +## +## The default values are left commented. They can be overridden either by +## uncommenting, or by using the command-line. + +# Chain to use (testnet, mainnet) +chain = "testnet" + +# Path to the wallet database +wallet_path = "~/.config/darkfi/darkfid_wallet.db" + +# Password for the wallet database +wallet_pass = "changeme" + +# Path to the blockchain database directory +database = "~/.config/darkfi/darkfid_blockchain" + +# JSON-RPC listen URL +rpc_listen = "tcp://127.0.0.1:18340" + +# Participate in the consensus protocol +consensus = true + +# P2P accept addresses for the consensus protocol +consensus_p2p_accept = ["tcp://127.0.0.1:8341"] + +# P2P external addresses for the consensus protocol +consensus_p2p_external = ["tcp://127.0.0.1:8341"] + +# Connection slots for the consensus protocol +consensus_slots = 0 + +# Seed nodes to connect to for the consensus protocol +#consensus_p2p_seed = [] + +# Seed nodes JSON-RPC listen URL for clock synchronization +#consensus_seed_rpc = [] + +# Peers to connect to for the consensus protocol +#consensus_p2p_peer = [] + +# Peers JSON-RPC listen URL for clock synchronization +#consensus_peer_rpc = [] + +# Prefered transports of outbound connections for the consensus protocol +#consensus_p2p_transports = ["tls", "tcp"] + +# P2P accept addresses for the syncing protocol +sync_p2p_accept = ["tcp://127.0.0.1:18342"] + +# P2P external addresses for the syncing protocol +sync_p2p_external = ["tcp://127.0.0.1:18342"] + +# Connection slots for the syncing protocol +sync_slots = 0 + +# Seed nodes to connect to for the syncing protocol +#sync_p2p_seed = [] + +# Peers to connect to for the syncing protocol +sync_p2p_peer = ["tcp://127.0.0.1:9342"] + +# Prefered transports of outbound connections for the syncing protocol +#sync_p2p_transports = ["tls", "tcp"] + +# Enable localnet hosts +localnet = true + +# Enable channel log +#channel_log = true + +# Whitelisted cashier addresses +#cashier_pub = [] + +# Whitelisted faucet addresses +faucet_pub = ["6R86xQZMWpPkmevs4LTL7AGfXzFoH3ohpq2N35xd7nBH"] + +# Verify system clock is correct +#clock_sync = true diff --git a/contrib/localnet/darkfid-temp/faucetd_config.toml b/contrib/localnet/darkfid-temp/faucetd_config.toml new file mode 100644 index 000000000..e8818de6e --- /dev/null +++ b/contrib/localnet/darkfid-temp/faucetd_config.toml @@ -0,0 +1,55 @@ +## faucetd configuration file +## +## Please make sure you go through all the settings so you can configure +## your daemon properly. +## +## The default values are left commented. They can be overridden either by +## uncommenting, or by using the command-line. + +# Chain to use (testnet, mainnet) +chain = "testnet" + +# Path to the wallet database +wallet_path = "~/.config/darkfi/faucetd_wallet.db" + +# Password for the wallet database +wallet_pass = "changeme" + +# Path to the blockchain database directory +database = "~/.config/darkfi/faucetd_blockchain" + +# JSON-RPC listen URL +rpc_listen = "tcp://127.0.0.1:8340" + +# P2P accept addresses for the syncing protocol +sync_p2p_accept = ["tcp://127.0.0.1:9342"] + +# P2P external addresses for the syncing protocol +sync_p2p_external = ["tcp://127.0.0.1:9342"] + +# Connection slots for the syncing protocol +sync_slots = 0 + +# Seed nodes to connect to for the syncing protocol +#sync_p2p_seed = [] + +# Peers to connect to for the syncing protocol +#sync_p2p_peer = [] + +# Prefered transports of outbound connections for the syncing protocol +#sync_p2p_transports = ["tls", "tcp"] + +# Enable localnet hosts +localnet = true + +# Enable channel log +#channel_log = true + +# Airdrop timeout limit in seconds +airdrop_timeout = 300 + +# Airdrop amount limit +airdrop_limit = "100" + +# Whitelisted faucet addresses +faucet_pub = ["6R86xQZMWpPkmevs4LTL7AGfXzFoH3ohpq2N35xd7nBH"] diff --git a/contrib/localnet/darkfid-temp/faucetd_wallet.db b/contrib/localnet/darkfid-temp/faucetd_wallet.db new file mode 100644 index 000000000..e9f844e58 Binary files /dev/null and b/contrib/localnet/darkfid-temp/faucetd_wallet.db differ