Skip to content

Commit

Permalink
Fix another iterator pointer issue (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondhands0 authored Jan 17, 2022
1 parent 6b2d32d commit 126a738
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/block_view_nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,8 @@ func (bav *UtxoView) _helpConnectNFTSold(args HelpConnectNFTSoldStruct) (
_additionalRoyaltiesNanos uint64, _additionalRoyalties []*PublicKeyRoyaltyPair, _err error) {
additionalRoyaltiesNanos := uint64(0)
var additionalRoyalties []*PublicKeyRoyaltyPair
for pkid, bps := range royaltyMap {
for pkidIter, bps := range royaltyMap {
pkid := pkidIter
royaltyNanos := IntDiv(
IntMul(
big.NewInt(int64(args.BidAmountNanos)),
Expand Down
8 changes: 7 additions & 1 deletion lib/block_view_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ func (bav *UtxoView) GetPKIDForPublicKey(publicKey []byte) *PKIDEntry {
}
}

func (bav *UtxoView) GetPublicKeyForPKID(pkid *PKID) []byte {
func (bav *UtxoView) GetPublicKeyForPKID(pkidArg *PKID) []byte {
// Put this check in place, since sometimes people accidentally
// pass a pointer that shouldn't be copied.
pkid := &PKID{}
if pkidArg != nil {
*pkid = *pkidArg
}
// If an entry exists in the in-memory map, return the value of that mapping.
mapValue, existsMapValue := bav.PKIDToPublicKey[*pkid]
if existsMapValue {
Expand Down

0 comments on commit 126a738

Please sign in to comment.