localnet: Weird case for block subscriptions

This commit is contained in:
parazyd
2022-11-26 17:38:16 +01:00
parent 4892432cde
commit efc9fd1bae
5 changed files with 172 additions and 2 deletions

View File

@@ -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<u8> = 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<u8> = serde_json::from_value(row[2].clone())?;
let serial: pallas::Base = deserialize(&serial_bytes)?;

View File

@@ -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?

View File

@@ -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

View File

@@ -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"]

Binary file not shown.