Updated sqlite dependency.
This commit is contained in:
Generated
+6
-6
@@ -1241,9 +1241,9 @@ checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlite"
|
name = "sqlite"
|
||||||
version = "0.26.0"
|
version = "0.30.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fb1a534c07ec276fbbe0e55a1c00814d8563da3a2f4d9d9d4c802bd1278db6a"
|
checksum = "8b1908664131c21a38e5b531344d52a196ec338af5bf44f7fa2c83d539e9561d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"sqlite3-sys",
|
"sqlite3-sys",
|
||||||
@@ -1251,9 +1251,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlite3-src"
|
name = "sqlite3-src"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a260b07ce75a0644c6f5891f34f46db9869e731838e95293469ab17999abcfa3"
|
checksum = "d1815a7a02c996eb8e5c64f61fcb6fd9b12e593ce265c512c5853b2513635691"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
@@ -1261,9 +1261,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlite3-sys"
|
name = "sqlite3-sys"
|
||||||
version = "0.13.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "04d2f028faeb14352df7934b4771806f60d61ce61be1928ec92396d7492e2e54"
|
checksum = "d47c99824fc55360ba00caf28de0b8a0458369b832e016a64c13af0ad9fbb9ee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"sqlite3-src",
|
"sqlite3-src",
|
||||||
|
|||||||
+3
-3
@@ -34,9 +34,9 @@ num-bigint = "0.4.3"
|
|||||||
num-traits = "0.2.15"
|
num-traits = "0.2.15"
|
||||||
chrono = { version = "0.4.20", features = ["serde"] }
|
chrono = { version = "0.4.20", features = ["serde"] }
|
||||||
time = "0.3.14"
|
time = "0.3.14"
|
||||||
rand = { version = "0.8.5", package = "rand" }
|
rand = { package = "rand", version = "0.8.5" }
|
||||||
rand-old = { package = "rand", version = "0.7.0" } # For ed25519-dalek
|
rand-old = { package = "rand", version = "0.7.0" } # For ed25519-dalek
|
||||||
sqlite = "0.26.0"
|
sqlite = "0.30.4"
|
||||||
uuid = { version = "1.3.0", features = ["serde", "v4"] }
|
uuid = { version = "1.3.0", features = ["serde", "v4"] }
|
||||||
mio = { version = "0.8.5", features = ["os-poll", "net"] }
|
mio = { version = "0.8.5", features = ["os-poll", "net"] }
|
||||||
ureq = { version = "2.5", optional = true }
|
ureq = { version = "2.5", optional = true }
|
||||||
@@ -46,7 +46,7 @@ lazy_static = "1.4.0"
|
|||||||
spmc = "0.3.0"
|
spmc = "0.3.0"
|
||||||
|
|
||||||
# Optional dependencies regulated by features
|
# Optional dependencies regulated by features
|
||||||
web-view = { git = "https://github.com/Boscop/web-view", ref = "e87e08cab3a2d500d54068ec9c7aaa055a711465", features = [], optional = true }
|
web-view = { git = "https://github.com/Boscop/web-view", features = [], optional = true }
|
||||||
tinyfiledialogs = { version = "3.9.1", optional = true }
|
tinyfiledialogs = { version = "3.9.1", optional = true }
|
||||||
open = { version = "3.0.3", optional = true }
|
open = { version = "3.0.3", optional = true }
|
||||||
|
|
||||||
|
|||||||
+63
-63
@@ -179,11 +179,11 @@ impl Chain {
|
|||||||
|
|
||||||
fn truncate_db_from_block(&mut self, index: u64) -> sqlite::Result<State> {
|
fn truncate_db_from_block(&mut self, index: u64) -> sqlite::Result<State> {
|
||||||
let mut statement = self.db.prepare(SQL_TRUNCATE_BLOCKS)?;
|
let mut statement = self.db.prepare(SQL_TRUNCATE_BLOCKS)?;
|
||||||
statement.bind(1, index as i64)?;
|
statement.bind((1, index as i64))?;
|
||||||
statement.next()?;
|
statement.next()?;
|
||||||
|
|
||||||
let mut statement = self.db.prepare(SQL_TRUNCATE_DOMAINS)?;
|
let mut statement = self.db.prepare(SQL_TRUNCATE_DOMAINS)?;
|
||||||
statement.bind(1, index as i64)?;
|
statement.bind((1, index as i64))?;
|
||||||
statement.next()
|
statement.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,8 +237,8 @@ impl Chain {
|
|||||||
let mut options = Options::empty();
|
let mut options = Options::empty();
|
||||||
if let Ok(mut statement) = self.db.prepare(SQL_GET_OPTIONS) {
|
if let Ok(mut statement) = self.db.prepare(SQL_GET_OPTIONS) {
|
||||||
while let State::Row = statement.next().unwrap() {
|
while let State::Row = statement.next().unwrap() {
|
||||||
let name = statement.read::<String>(0).unwrap();
|
let name: String = statement.read(0).unwrap();
|
||||||
let value = statement.read::<String>(1).unwrap();
|
let value: String = statement.read(1).unwrap();
|
||||||
match name.as_ref() {
|
match name.as_ref() {
|
||||||
"origin" => options.origin = value,
|
"origin" => options.origin = value,
|
||||||
"version" => options.version = value.parse().unwrap(),
|
"version" => options.version = value.parse().unwrap(),
|
||||||
@@ -374,24 +374,24 @@ impl Chain {
|
|||||||
/// Adds block to blocks table
|
/// Adds block to blocks table
|
||||||
fn add_block_to_table(&mut self, block: Block) -> sqlite::Result<State> {
|
fn add_block_to_table(&mut self, block: Block) -> sqlite::Result<State> {
|
||||||
let mut statement = self.db.prepare(SQL_ADD_BLOCK)?;
|
let mut statement = self.db.prepare(SQL_ADD_BLOCK)?;
|
||||||
statement.bind(1, block.index as i64)?;
|
statement.bind((1, block.index as i64))?;
|
||||||
statement.bind(2, block.timestamp as i64)?;
|
statement.bind((2, block.timestamp as i64))?;
|
||||||
statement.bind(3, block.version as i64)?;
|
statement.bind((3, block.version as i64))?;
|
||||||
statement.bind(4, block.difficulty as i64)?;
|
statement.bind((4, block.difficulty as i64))?;
|
||||||
statement.bind(5, block.random as i64)?;
|
statement.bind((5, block.random as i64))?;
|
||||||
statement.bind(6, block.nonce as i64)?;
|
statement.bind((6, block.nonce as i64))?;
|
||||||
match &block.transaction {
|
match &block.transaction {
|
||||||
None => {
|
None => {
|
||||||
statement.bind(7, "")?;
|
statement.bind((7, ""))?;
|
||||||
}
|
}
|
||||||
Some(transaction) => {
|
Some(transaction) => {
|
||||||
statement.bind(7, transaction.to_string().as_str())?;
|
statement.bind((7, transaction.to_string().as_str()))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statement.bind(8, block.prev_block_hash.as_slice())?;
|
statement.bind((8, block.prev_block_hash.as_slice()))?;
|
||||||
statement.bind(9, block.hash.as_slice())?;
|
statement.bind((9, block.hash.as_slice()))?;
|
||||||
statement.bind(10, block.pub_key.as_slice())?;
|
statement.bind((10, block.pub_key.as_slice()))?;
|
||||||
statement.bind(11, block.signature.as_slice())?;
|
statement.bind((11, block.signature.as_slice()))?;
|
||||||
statement.next()
|
statement.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,20 +404,20 @@ impl Chain {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut statement = self.db.prepare(sql)?;
|
let mut statement = self.db.prepare(sql)?;
|
||||||
statement.bind(1, index as i64)?;
|
statement.bind((1, index as i64))?;
|
||||||
statement.bind(2, timestamp)?;
|
statement.bind((2, timestamp))?;
|
||||||
statement.bind(3, t.identity.as_slice())?;
|
statement.bind((3, t.identity.as_slice()))?;
|
||||||
statement.bind(4, t.confirmation.as_slice())?;
|
statement.bind((4, t.confirmation.as_slice()))?;
|
||||||
statement.bind(5, t.data.as_ref() as &str)?;
|
statement.bind((5, t.data.as_ref() as &str))?;
|
||||||
statement.bind(6, t.signing.as_slice())?;
|
statement.bind((6, t.signing.as_slice()))?;
|
||||||
statement.bind(7, t.encryption.as_slice())?;
|
statement.bind((7, t.encryption.as_slice()))?;
|
||||||
statement.next()
|
statement.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_block(&self, index: u64) -> Option<Block> {
|
pub fn get_block(&self, index: u64) -> Option<Block> {
|
||||||
match self.db.prepare(SQL_GET_BLOCK_BY_ID) {
|
match self.db.prepare(SQL_GET_BLOCK_BY_ID) {
|
||||||
Ok(mut statement) => {
|
Ok(mut statement) => {
|
||||||
statement.bind(1, index as i64).expect("Error in bind");
|
statement.bind((1, index as i64)).expect("Error in bind");
|
||||||
if statement.next().unwrap() == State::Row {
|
if statement.next().unwrap() == State::Row {
|
||||||
return match Self::get_block_from_statement(&mut statement) {
|
return match Self::get_block_from_statement(&mut statement) {
|
||||||
None => {
|
None => {
|
||||||
@@ -459,13 +459,13 @@ impl Chain {
|
|||||||
let mut statement = match pub_key {
|
let mut statement = match pub_key {
|
||||||
None => {
|
None => {
|
||||||
let mut statement = self.db.prepare(SQL_GET_LAST_FULL_BLOCK).expect("Unable to prepare");
|
let mut statement = self.db.prepare(SQL_GET_LAST_FULL_BLOCK).expect("Unable to prepare");
|
||||||
statement.bind(1, before as i64).expect("Unable to bind");
|
statement.bind((1, before as i64)).expect("Unable to bind");
|
||||||
statement
|
statement
|
||||||
}
|
}
|
||||||
Some(pub_key) => {
|
Some(pub_key) => {
|
||||||
let mut statement = self.db.prepare(SQL_GET_LAST_FULL_BLOCK_FOR_KEY).expect("Unable to prepare");
|
let mut statement = self.db.prepare(SQL_GET_LAST_FULL_BLOCK_FOR_KEY).expect("Unable to prepare");
|
||||||
statement.bind(1, before as i64).expect("Unable to bind");
|
statement.bind((1, before as i64)).expect("Unable to bind");
|
||||||
statement.bind(2, pub_key).expect("Unable to bind");
|
statement.bind((2, pub_key)).expect("Unable to bind");
|
||||||
statement
|
statement
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -576,8 +576,8 @@ impl Chain {
|
|||||||
pub fn is_domain_in_blockchain(&self, height: u64, id: &Bytes) -> bool {
|
pub fn is_domain_in_blockchain(&self, height: u64, id: &Bytes) -> bool {
|
||||||
// Checking for existing domain in DB
|
// Checking for existing domain in DB
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAIN_OWNER_BY_ID).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAIN_OWNER_BY_ID).unwrap();
|
||||||
statement.bind(1, height as i64).expect("Error in bind");
|
statement.bind((1, height as i64)).expect("Error in bind");
|
||||||
statement.bind(2, id.as_slice()).expect("Error in bind");
|
statement.bind((2, id.as_slice())).expect("Error in bind");
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
// If there is such an ID
|
// If there is such an ID
|
||||||
return true;
|
return true;
|
||||||
@@ -587,9 +587,9 @@ impl Chain {
|
|||||||
|
|
||||||
pub fn get_domain_renewal_time(&self, time: i64, identity_hash: &Bytes) -> Option<i64> {
|
pub fn get_domain_renewal_time(&self, time: i64, identity_hash: &Bytes) -> Option<i64> {
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAIN_UPDATE_TIME).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAIN_UPDATE_TIME).unwrap();
|
||||||
statement.bind(1, identity_hash.as_slice()).expect("Error in bind");
|
statement.bind((1, identity_hash.as_slice())).expect("Error in bind");
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
let timestamp = statement.read::<i64>(0).unwrap();
|
let timestamp: i64 = statement.read(0).unwrap();
|
||||||
if timestamp < time - DOMAIN_LIFETIME {
|
if timestamp < time - DOMAIN_LIFETIME {
|
||||||
// This domain is too old
|
// This domain is too old
|
||||||
return None;
|
return None;
|
||||||
@@ -601,10 +601,10 @@ impl Chain {
|
|||||||
|
|
||||||
pub fn get_domain_update_time(&self, identity_hash: &Bytes, height: u64, time: i64) -> Option<i64> {
|
pub fn get_domain_update_time(&self, identity_hash: &Bytes, height: u64, time: i64) -> Option<i64> {
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAIN_BY_ID).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAIN_BY_ID).unwrap();
|
||||||
statement.bind(1, identity_hash.as_slice()).expect("Error in bind");
|
statement.bind((1, identity_hash.as_slice())).expect("Error in bind");
|
||||||
statement.bind(2, height as i64 ).expect("Error in bind");
|
statement.bind((2, height as i64)).expect("Error in bind");
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
let timestamp = statement.read::<i64>(1).unwrap();
|
let timestamp: i64 = statement.read(1).unwrap();
|
||||||
if timestamp < time - DOMAIN_LIFETIME {
|
if timestamp < time - DOMAIN_LIFETIME {
|
||||||
// This domain is too old
|
// This domain is too old
|
||||||
return None;
|
return None;
|
||||||
@@ -616,10 +616,10 @@ impl Chain {
|
|||||||
|
|
||||||
pub fn get_identity_transaction_and_state(&self, identity_hash: &Bytes, height: u64, time: i64) -> (Option<Transaction>, DomainState) {
|
pub fn get_identity_transaction_and_state(&self, identity_hash: &Bytes, height: u64, time: i64) -> (Option<Transaction>, DomainState) {
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAIN_BY_ID).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAIN_BY_ID).unwrap();
|
||||||
statement.bind(1, identity_hash.as_slice()).expect("Error in bind");
|
statement.bind((1, identity_hash.as_slice())).expect("Error in bind");
|
||||||
statement.bind(2, height as i64).expect("Error in bind");
|
statement.bind((2, height as i64)).expect("Error in bind");
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
let timestamp = statement.read::<i64>(1).unwrap();
|
let timestamp: i64 = statement.read(1).unwrap();
|
||||||
// Determine current state of the domain
|
// Determine current state of the domain
|
||||||
let state = if timestamp + DOMAIN_LIFETIME >= time {
|
let state = if timestamp + DOMAIN_LIFETIME >= time {
|
||||||
DomainState::Alive { renewed_time: timestamp, until: timestamp + DOMAIN_LIFETIME }
|
DomainState::Alive { renewed_time: timestamp, until: timestamp + DOMAIN_LIFETIME }
|
||||||
@@ -628,12 +628,12 @@ impl Chain {
|
|||||||
} else {
|
} else {
|
||||||
DomainState::Free { renewed_time: timestamp }
|
DomainState::Free { renewed_time: timestamp }
|
||||||
};
|
};
|
||||||
let identity = Bytes::from_bytes(&statement.read::<Vec<u8>>(2).unwrap());
|
let identity = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(2).unwrap());
|
||||||
let confirmation = Bytes::from_bytes(&statement.read::<Vec<u8>>(3).unwrap());
|
let confirmation = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(3).unwrap());
|
||||||
let class = String::from(CLASS_DOMAIN);
|
let class = String::from(CLASS_DOMAIN);
|
||||||
let data = statement.read::<String>(4).unwrap();
|
let data: String = statement.read(4).unwrap();
|
||||||
let signing = Bytes::from_bytes(&statement.read::<Vec<u8>>(5).unwrap());
|
let signing = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(5).unwrap());
|
||||||
let encryption = Bytes::from_bytes(&statement.read::<Vec<u8>>(6).unwrap());
|
let encryption = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(6).unwrap());
|
||||||
let transaction = Transaction { identity, confirmation, class, data, signing, encryption };
|
let transaction = Transaction { identity, confirmation, class, data, signing, encryption };
|
||||||
return (Some(transaction), state);
|
return (Some(transaction), state);
|
||||||
}
|
}
|
||||||
@@ -672,7 +672,7 @@ impl Chain {
|
|||||||
pub fn get_domains_count(&self) -> i64 {
|
pub fn get_domains_count(&self) -> i64 {
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAINS_COUNT).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAINS_COUNT).unwrap();
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
return statement.read::<i64>(0).unwrap();
|
return statement.read::<i64, usize>(0).unwrap();
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -680,17 +680,17 @@ impl Chain {
|
|||||||
pub fn get_users_count(&self) -> i64 {
|
pub fn get_users_count(&self) -> i64 {
|
||||||
let mut statement = self.db.prepare(SQL_GET_USERS_COUNT).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_USERS_COUNT).unwrap();
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
return statement.read::<i64>(0).unwrap();
|
return statement.read::<i64, usize>(0).unwrap();
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_user_block_count(&self, pub_key: &Bytes, max_height: u64) -> i64 {
|
pub fn get_user_block_count(&self, pub_key: &Bytes, max_height: u64) -> i64 {
|
||||||
let mut statement = self.db.prepare(SQL_GET_USER_BLOCK_COUNT).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_USER_BLOCK_COUNT).unwrap();
|
||||||
statement.bind(1, pub_key.as_slice()).expect("Error in bind");
|
statement.bind((1, pub_key.as_slice())).expect("Error in bind");
|
||||||
statement.bind(2, max_height as i64).expect("Error in bind");
|
statement.bind((2, max_height as i64)).expect("Error in bind");
|
||||||
if let State::Row = statement.next().unwrap() {
|
if let State::Row = statement.next().unwrap() {
|
||||||
return statement.read::<i64>(0).unwrap();
|
return statement.read::<i64, usize>(0).unwrap();
|
||||||
}
|
}
|
||||||
0i64
|
0i64
|
||||||
}
|
}
|
||||||
@@ -704,13 +704,13 @@ impl Chain {
|
|||||||
let keystore = keystore.unwrap();
|
let keystore = keystore.unwrap();
|
||||||
let pub_key = keystore.get_public();
|
let pub_key = keystore.get_public();
|
||||||
let mut statement = self.db.prepare(SQL_GET_DOMAINS_BY_KEY).unwrap();
|
let mut statement = self.db.prepare(SQL_GET_DOMAINS_BY_KEY).unwrap();
|
||||||
statement.bind(1, pub_key.as_slice()).expect("Error in bind");
|
statement.bind((1, pub_key.as_slice())).expect("Error in bind");
|
||||||
let height = self.get_height();
|
let height = self.get_height();
|
||||||
while let State::Row = statement.next().unwrap() {
|
while let State::Row = statement.next().unwrap() {
|
||||||
let timestamp = statement.read::<i64>(0).unwrap();
|
let timestamp = statement.read::<i64, usize>(0).unwrap();
|
||||||
let identity = Bytes::from_bytes(&statement.read::<Vec<u8>>(1).unwrap());
|
let identity = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(1).unwrap());
|
||||||
let data = statement.read::<String>(2).unwrap();
|
let data = statement.read::<String, usize>(2).unwrap();
|
||||||
let signing = Bytes::from_bytes(&statement.read::<Vec<u8>>(3).unwrap());
|
let signing = Bytes::from_bytes(&statement.read::<Vec<u8>, usize>(3).unwrap());
|
||||||
|
|
||||||
// Get the last transaction for this id and check if it is still ours
|
// Get the last transaction for this id and check if it is still ours
|
||||||
// TODO use state to show it in UI
|
// TODO use state to show it in UI
|
||||||
@@ -1067,17 +1067,17 @@ impl Chain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_block_from_statement(statement: &mut Statement) -> Option<Block> {
|
fn get_block_from_statement(statement: &mut Statement) -> Option<Block> {
|
||||||
let index = statement.read::<i64>(0).unwrap() as u64;
|
let index = statement.read::<i64, usize>(0).unwrap() as u64;
|
||||||
let timestamp = statement.read::<i64>(1).unwrap();
|
let timestamp = statement.read::<i64, usize>(1).unwrap();
|
||||||
let version = statement.read::<i64>(2).unwrap() as u32;
|
let version = statement.read::<i64, usize>(2).unwrap() as u32;
|
||||||
let difficulty = statement.read::<i64>(3).unwrap() as u32;
|
let difficulty = statement.read::<i64, usize>(3).unwrap() as u32;
|
||||||
let random = statement.read::<i64>(4).unwrap() as u32;
|
let random = statement.read::<i64, usize>(4).unwrap() as u32;
|
||||||
let nonce = statement.read::<i64>(5).unwrap() as u64;
|
let nonce = statement.read::<i64, usize>(5).unwrap() as u64;
|
||||||
let transaction = Transaction::from_json(&statement.read::<String>(6).unwrap());
|
let transaction = Transaction::from_json(&statement.read::<String, usize>(6).unwrap());
|
||||||
let prev_block_hash = Bytes::from_bytes(statement.read::<Vec<u8>>(7).unwrap().as_slice());
|
let prev_block_hash = Bytes::from_bytes(statement.read::<Vec<u8>, usize>(7).unwrap().as_slice());
|
||||||
let hash = Bytes::from_bytes(statement.read::<Vec<u8>>(8).unwrap().as_slice());
|
let hash = Bytes::from_bytes(statement.read::<Vec<u8>, usize>(8).unwrap().as_slice());
|
||||||
let pub_key = Bytes::from_bytes(statement.read::<Vec<u8>>(9).unwrap().as_slice());
|
let pub_key = Bytes::from_bytes(statement.read::<Vec<u8>, usize>(9).unwrap().as_slice());
|
||||||
let signature = Bytes::from_bytes(statement.read::<Vec<u8>>(10).unwrap().as_slice());
|
let signature = Bytes::from_bytes(statement.read::<Vec<u8>, usize>(10).unwrap().as_slice());
|
||||||
Some(Block::from_all_params(index, timestamp, version, difficulty, random, nonce, prev_block_hash, hash, pub_key, signature, transaction))
|
Some(Block::from_all_params(index, timestamp, version, difficulty, random, nonce, prev_block_hash, hash, pub_key, signature, transaction))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user