Skip to content

Commit 5a85d49

Browse files
committed
add oracle store by pub key
1 parent 181e5d5 commit 5a85d49

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

x/dlc/keeper/oracle.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ func (k Keeper) SetOracle(ctx sdk.Context, oracle *types.DLCOracle) {
124124
store.Set(types.OracleKey(oracle.Id), bz)
125125
}
126126

127+
// SetOracleByPubKey sets the given oracle by pub key
128+
func (k Keeper) SetOracleByPubKey(ctx sdk.Context, oracleId uint64, pubKey []byte) {
129+
store := ctx.KVStore(k.storeKey)
130+
131+
store.Set(types.OracleByPubKeyKey(pubKey), sdk.Uint64ToBigEndian(oracleId))
132+
}
133+
127134
// HasPendingOraclePubKey returns true if the given pending oracle pubkey exists, false otherwise
128135
func (k Keeper) HasPendingOraclePubKey(ctx sdk.Context, oracleId uint64, pubKey []byte) bool {
129136
store := ctx.KVStore(k.storeKey)

x/dlc/module/abci.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func handlePendingOracles(ctx sdk.Context, k keeper.Keeper) {
5151
oracle.Status = types.DLCOracleStatus_Oracle_status_Enable
5252

5353
k.SetOracle(ctx, oracle)
54+
k.SetOracleByPubKey(ctx, oracle.Id, pubKeys[0])
5455
}
5556
}
5657

0 commit comments

Comments
 (0)