mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 04:11:08 +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);
|
let rpos = self.commit_index.get_output_pos(commit);
|
||||||
match rpos {
|
match rpos {
|
||||||
Ok(pos) => {
|
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 {
|
if pos > self.output_pmmr_h.last_pos {
|
||||||
Ok(false)
|
Ok(false)
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,6 +261,8 @@ impl<'a> Extension<'a> {
|
||||||
|
|
||||||
for out in &b.outputs {
|
for out in &b.outputs {
|
||||||
if let Ok(pos) = self.commit_index.get_output_pos(&out.commitment()) {
|
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() {
|
if pos <= self.output_pmmr.unpruned_size() {
|
||||||
return Err(Error::DuplicateCommitment(out.commitment()));
|
return Err(Error::DuplicateCommitment(out.commitment()));
|
||||||
}
|
}
|
||||||
|
@ -284,6 +288,8 @@ impl<'a> Extension<'a> {
|
||||||
for kernel in &b.kernels {
|
for kernel in &b.kernels {
|
||||||
if let Ok(pos) = self.commit_index.get_kernel_pos(&kernel.excess) {
|
if let Ok(pos) = self.commit_index.get_kernel_pos(&kernel.excess) {
|
||||||
if pos <= self.kernel_pmmr.unpruned_size() {
|
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()));
|
return Err(Error::DuplicateKernel(kernel.excess.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue