Przeglądaj źródła

consensus: Replace old Transaction type with new one.

parazyd 3 lat temu
rodzic
commit
3756b10946

+ 1 - 1
src/blockchain/txstore.rs

@@ -18,7 +18,7 @@
 
 
 use darkfi_serial::{deserialize, serialize};
 use darkfi_serial::{deserialize, serialize};
 
 
-use crate::{tx::Transaction, Error, Result};
+use crate::{tx2::Transaction, Error, Result};
 
 
 const SLED_TX_TREE: &[u8] = b"_transactions";
 const SLED_TX_TREE: &[u8] = b"_transactions";
 
 

+ 1 - 1
src/consensus/block.rs

@@ -28,7 +28,7 @@ use super::{
     constants::{BLOCK_MAGIC_BYTES, BLOCK_VERSION},
     constants::{BLOCK_MAGIC_BYTES, BLOCK_VERSION},
     Metadata,
     Metadata,
 };
 };
-use crate::{net, tx::Transaction, util::time::Timestamp};
+use crate::{net, tx2::Transaction, util::time::Timestamp};
 
 
 /// This struct represents a tuple of the form (version, previous, epoch, slot, timestamp, merkle_root).
 /// This struct represents a tuple of the form (version, previous, epoch, slot, timestamp, merkle_root).
 #[derive(Debug, Clone, PartialEq, Eq, SerialEncodable, SerialDecodable)]
 #[derive(Debug, Clone, PartialEq, Eq, SerialEncodable, SerialDecodable)]

+ 1 - 1
src/consensus/proto/protocol_tx.rs

@@ -29,7 +29,7 @@ use crate::{
         ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr,
         ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr,
         ProtocolJobsManager, ProtocolJobsManagerPtr,
         ProtocolJobsManager, ProtocolJobsManagerPtr,
     },
     },
-    tx::Transaction,
+    tx2::Transaction,
     Result,
     Result,
 };
 };
 
 

+ 9 - 8
src/consensus/state.rs

@@ -56,7 +56,7 @@ use crate::{
     crypto::proof::{ProvingKey, VerifyingKey},
     crypto::proof::{ProvingKey, VerifyingKey},
     net,
     net,
     runtime::vm_runtime::Runtime,
     runtime::vm_runtime::Runtime,
-    tx::Transaction,
+    tx2::Transaction,
     util::time::Timestamp,
     util::time::Timestamp,
     wallet::WalletPtr,
     wallet::WalletPtr,
     zk::circuit::LeadContract,
     zk::circuit::LeadContract,
@@ -166,13 +166,12 @@ impl ValidatorState {
         info!("Initializing ValidatorState");
         info!("Initializing ValidatorState");
 
 
         info!("Initializing wallet tables for consensus");
         info!("Initializing wallet tables for consensus");
-        // TODO: TESTNET: The stuff is kept entirely in memory for now, this should be written
-        //                into the wallet when necessary.
-        let consensus_tree_init_query = include_str!("../../script/sql/consensus_tree.sql");
-        let consensus_keys_init_query = include_str!("../../script/sql/consensus_keys.sql");
-        // TODO: TESTNET: consensus coin table
-        wallet.exec_sql(consensus_tree_init_query).await?;
-        wallet.exec_sql(consensus_keys_init_query).await?;
+        // TODO: TESTNET: The stuff is kept entirely in memory for now, what should we write
+        //                to disk/wallet?
+        //let consensus_tree_init_query = include_str!("../../script/sql/consensus_tree.sql");
+        //let consensus_keys_init_query = include_str!("../../script/sql/consensus_keys.sql");
+        //wallet.exec_sql(consensus_tree_init_query).await?;
+        //wallet.exec_sql(consensus_keys_init_query).await?;
 
 
         let secret_key = SecretKey::random(&mut OsRng);
         let secret_key = SecretKey::random(&mut OsRng);
         let public_key = PublicKey::from_secret(secret_key);
         let public_key = PublicKey::from_secret(secret_key);
@@ -540,12 +539,14 @@ impl ValidatorState {
         let unproposed_txs = self.unproposed_txs(index);
         let unproposed_txs = self.unproposed_txs(index);
 
 
         let mut tree = BridgeTree::<MerkleNode, MERKLE_DEPTH>::new(100);
         let mut tree = BridgeTree::<MerkleNode, MERKLE_DEPTH>::new(100);
+        /* TODO: FIXME: TESTNET:
         for tx in &unproposed_txs {
         for tx in &unproposed_txs {
             for output in &tx.outputs {
             for output in &tx.outputs {
                 tree.append(&MerkleNode::from(output.revealed.coin.0));
                 tree.append(&MerkleNode::from(output.revealed.coin.0));
                 tree.witness();
                 tree.witness();
             }
             }
         }
         }
+        */
         let root = tree.root(0).unwrap();
         let root = tree.root(0).unwrap();
         let header =
         let header =
             Header::new(prev_hash, self.slot_epoch(slot), slot, Timestamp::current_time(), root);
             Header::new(prev_hash, self.slot_epoch(slot), slot, Timestamp::current_time(), root);