mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Better comments for PMMR size check
This commit is contained in:
parent
5807a6b270
commit
31f8f2ad3e
1 changed files with 6 additions and 0 deletions
|
@ -94,6 +94,8 @@ impl SumTrees {
|
|||
let rpos = self.commit_index.get_output_pos(commit);
|
||||
match rpos {
|
||||
Ok(pos) => {
|
||||
// checking the position is within the MMR, the commit index could be
|
||||
// returning rewound data
|
||||
if pos > self.output_pmmr_h.last_pos {
|
||||
Ok(false)
|
||||
} else {
|
||||
|
@ -259,6 +261,8 @@ impl<'a> Extension<'a> {
|
|||
|
||||
for out in &b.outputs {
|
||||
if let Ok(pos) = self.commit_index.get_output_pos(&out.commitment()) {
|
||||
// checking the position is within the MMR, the commit index could be
|
||||
// returning rewound data
|
||||
if pos <= self.output_pmmr.unpruned_size() {
|
||||
return Err(Error::DuplicateCommitment(out.commitment()));
|
||||
}
|
||||
|
@ -284,6 +288,8 @@ impl<'a> Extension<'a> {
|
|||
for kernel in &b.kernels {
|
||||
if let Ok(pos) = self.commit_index.get_kernel_pos(&kernel.excess) {
|
||||
if pos <= self.kernel_pmmr.unpruned_size() {
|
||||
// checking the position is within the MMR, the commit index could be
|
||||
// returning rewound data
|
||||
return Err(Error::DuplicateKernel(kernel.excess.clone()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue