Start new leaf id at 0
This change updates the initial leaf node id to start at 1, if there are
no leaf nodes found for a given tree. Prior to this commit, all leaves
would start at id 2.
@@ -70,7 +70,7 @@ impl<'a> MerkleRadixInsertNodesOperation for MerkleRadixOperations<'a, SqliteCon
let initial_id: i64 = merkle_radix_leaf::table
.select(max(merkle_radix_leaf::id))
.first::<Option<i64>>(self.conn)?
- .unwrap_or(1);
+ .unwrap_or(0);
let leaves = nodes
.iter()
@@ -150,7 +150,7 @@ impl<'a> MerkleRadixInsertNodesOperation for MerkleRadixOperations<'a, PgConnect
let initial_id: i64 = merkle_radix_leaf::table
.select(max(merkle_radix_leaf::id))
.first::<Option<i64>>(self.conn)?
- .unwrap_or(1);
+ .unwrap_or(0);
let leaves = nodes
.iter()
