mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
Compare commits
3 Commits
bd7e7f48e8
...
7eb9eb875c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7eb9eb875c | ||
![]() |
395aeabde7 | ||
![]() |
b0e273e141 |
@ -269,8 +269,7 @@ impl LogStoreWrite for LogManager {
|
||||
|
||||
if let Some(old_tx_seq) = maybe_same_data_tx_seq {
|
||||
if self.check_tx_completed(old_tx_seq)? {
|
||||
self.copy_tx_data(old_tx_seq, vec![tx.seq])?;
|
||||
self.tx_store.finalize_tx(tx.seq)?;
|
||||
self.copy_tx_and_finalize(old_tx_seq, vec![tx.seq])?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -293,7 +292,7 @@ impl LogStoreWrite for LogManager {
|
||||
.get_tx_seq_list_by_data_root(&tx.data_merkle_root)?;
|
||||
// Check if there are other same-root transaction not finalized.
|
||||
if same_root_seq_list.first() == Some(&tx_seq) {
|
||||
self.copy_tx_data(tx_seq, same_root_seq_list[1..].to_vec())?;
|
||||
self.copy_tx_and_finalize(tx_seq, same_root_seq_list[1..].to_vec())?;
|
||||
}
|
||||
self.tx_store.finalize_tx(tx_seq)?;
|
||||
Ok(())
|
||||
@ -329,7 +328,7 @@ impl LogStoreWrite for LogManager {
|
||||
.get_tx_seq_list_by_data_root(&tx.data_merkle_root)?;
|
||||
// Check if there are other same-root transaction not finalized.
|
||||
if same_root_seq_list.first() == Some(&tx_seq) {
|
||||
self.copy_tx_data(tx_seq, same_root_seq_list[1..].to_vec())?;
|
||||
self.copy_tx_and_finalize(tx_seq, same_root_seq_list[1..].to_vec())?;
|
||||
}
|
||||
Ok(true)
|
||||
} else {
|
||||
@ -1059,8 +1058,9 @@ impl LogManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn copy_tx_data(&self, from_tx_seq: u64, to_tx_seq_list: Vec<u64>) -> Result<()> {
|
||||
fn copy_tx_and_finalize(&self, from_tx_seq: u64, to_tx_seq_list: Vec<u64>) -> Result<()> {
|
||||
let mut merkle = self.merkle.write();
|
||||
let shard_config = self.flow_store.get_shard_config();
|
||||
// We have all the data need for this tx, so just copy them.
|
||||
let old_tx = self
|
||||
.get_tx_by_seq_number(from_tx_seq)?
|
||||
@ -1074,6 +1074,12 @@ impl LogManager {
|
||||
let tx = self
|
||||
.get_tx_by_seq_number(seq)?
|
||||
.ok_or_else(|| anyhow!("to tx missing"))?;
|
||||
// Data for `tx` is not available due to sharding.
|
||||
if sector_to_segment(tx.start_entry_index) % shard_config.num_shard
|
||||
!= sector_to_segment(old_tx.start_entry_index) % shard_config.num_shard
|
||||
{
|
||||
continue;
|
||||
}
|
||||
to_tx_offset_list.push((tx.seq, tx.start_entry_index - old_tx.start_entry_index));
|
||||
}
|
||||
if to_tx_offset_list.is_empty() {
|
||||
@ -1085,7 +1091,7 @@ impl LogManager {
|
||||
old_tx.start_entry_index,
|
||||
old_tx.start_entry_index + old_tx.num_entries() as u64,
|
||||
PORA_CHUNK_SIZE,
|
||||
self.flow_store.get_shard_config(),
|
||||
shard_config,
|
||||
) {
|
||||
let batch_data = self
|
||||
.get_chunk_by_flow_index(batch_start, batch_end - batch_start)?
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
# List of nodes to bootstrap UDP discovery. Note, `network_enr_address` should be
|
||||
# configured as well to enable UDP discovery.
|
||||
network_boot_nodes = ["/ip4/35.95.5.134/udp/1234/p2p/16Uiu2HAmFGrDV8wKToa1dd8uh6bz8bSY28n33iRP3pvfeBU6ysCw","/ip4/35.84.189.77/udp/1234/p2p/16Uiu2HAmF7t5iuRoWLMvQVfHbbJr5TFgHo2oU1CDxJm56eLdxRAY","/ip4/8.154.34.28/udp/1234/p2p/16Uiu2HAmBb7PQzvfZjHBENcF7E7mZaiHSrpBoH7mKTyNijYdqMM6"]
|
||||
network_boot_nodes = ["/ip4/52.24.167.216/udp/1234/p2p/16Uiu2HAmFGrDV8wKToa1dd8uh6bz8bSY28n33iRP3pvfeBU6ysCw","/ip4/44.237.182.79/udp/1234/p2p/16Uiu2HAmF7t5iuRoWLMvQVfHbbJr5TFgHo2oU1CDxJm56eLdxRAY","/ip4/47.97.193.51/udp/1234/p2p/16Uiu2HAmBb7PQzvfZjHBENcF7E7mZaiHSrpBoH7mKTyNijYdqMM6"]
|
||||
|
||||
# List of libp2p nodes to initially connect to.
|
||||
# network_libp2p_nodes = []
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
# List of nodes to bootstrap UDP discovery. Note, `network_enr_address` should be
|
||||
# configured as well to enable UDP discovery.
|
||||
network_boot_nodes = ["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/8.154.47.100/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]
|
||||
network_boot_nodes = ["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/121.43.181.26/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]
|
||||
|
||||
# List of libp2p nodes to initially connect to.
|
||||
# network_libp2p_nodes = []
|
||||
|
Loading…
Reference in New Issue
Block a user