Skip to content

Commit fe3e25c

Browse files
committed
add isExpired
1 parent 4cee9df commit fe3e25c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tree.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ func (n *InternalNode) GetValuesAtStem(stem Stem, curPeriod StatePeriod, resolve
651651
case *ExpiredLeafNode:
652652
return nil, errExpired
653653
case *LeafNode:
654-
if IsExpired(child.lastPeriod, curPeriod) {
654+
if child.isExpired(curPeriod) {
655655
return nil, errExpired
656656
}
657657

@@ -752,7 +752,7 @@ func (n *InternalNode) DeleteAtStem(key []byte, curPeriod StatePeriod, resolver
752752
return false, errDeleteMissing
753753
}
754754

755-
if IsExpired(child.lastPeriod, curPeriod) {
755+
if child.isExpired(curPeriod) {
756756
return false, errExpired
757757
}
758758

@@ -1249,7 +1249,7 @@ func (n *LeafNode) Insert(key []byte, value []byte, curPeriod StatePeriod, _ Nod
12491249
return fmt.Errorf("invalid key size: %d", len(key))
12501250
}
12511251

1252-
if IsExpired(n.lastPeriod, curPeriod) {
1252+
if n.isExpired(curPeriod) {
12531253
return errExpired
12541254
}
12551255

@@ -1268,7 +1268,7 @@ func (n *LeafNode) insertMultiple(stem Stem, values [][]byte, curPeriod StatePer
12681268
return errInsertIntoOtherStem
12691269
}
12701270

1271-
if IsExpired(n.lastPeriod, curPeriod) {
1271+
if n.isExpired(curPeriod) {
12721272
return errExpired
12731273
}
12741274

@@ -1435,7 +1435,7 @@ func (n *LeafNode) Delete(k []byte, curPeriod StatePeriod, _ NodeResolverFn) (bo
14351435
return false, nil
14361436
}
14371437

1438-
if IsExpired(n.lastPeriod, curPeriod) {
1438+
if n.isExpired(curPeriod) {
14391439
return false, errExpired
14401440
}
14411441

@@ -1535,7 +1535,7 @@ func (n *LeafNode) Get(k []byte, curPeriod StatePeriod, _ NodeResolverFn) ([]byt
15351535
return nil, errIsPOAStub
15361536
}
15371537

1538-
if IsExpired(n.lastPeriod, curPeriod) {
1538+
if n.isExpired(curPeriod) {
15391539
return nil, errExpired
15401540
}
15411541

@@ -1611,6 +1611,10 @@ func (n *LeafNode) updatePeriod(curPeriod StatePeriod) {
16111611
n.commitment.Add(n.commitment, cfg.CommitToPoly(poly[:], 0))
16121612
}
16131613

1614+
func (n *LeafNode) isExpired(cur StatePeriod) bool {
1615+
return IsExpired(n.lastPeriod, cur)
1616+
}
1617+
16141618
// fillSuffixTreePoly takes one of the two suffix tree and
16151619
// builds the associated polynomial, to be used to compute
16161620
// the corresponding C{1,2} commitment.

0 commit comments

Comments
 (0)