File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
database/plugin/metadata/sqlite Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -268,16 +268,27 @@ func (d *MetadataStoreSqlite) SetStakeRegistration(
268268 slot , deposit uint64 ,
269269 txn * gorm.DB ,
270270) error {
271+ tmpAccount := models.Account {
272+ StakingKey : cert .StakeRegistration .Credential .Bytes (),
273+ AddedSlot : slot ,
274+ DepositAmount : deposit ,
275+ }
271276 tmpItem := models.StakeRegistration {
272277 StakingKey : cert .StakeRegistration .Credential .Bytes (),
273278 AddedSlot : slot ,
274279 DepositAmount : deposit ,
275280 }
276281 if txn != nil {
282+ if accountResult := txn .Create (& tmpAccount ); accountResult .Error != nil {
283+ return accountResult .Error
284+ }
277285 if result := txn .Create (& tmpItem ); result .Error != nil {
278286 return result .Error
279287 }
280288 } else {
289+ if accountResult := d .DB ().Create (& tmpAccount ); accountResult .Error != nil {
290+ return accountResult .Error
291+ }
281292 if result := d .DB ().Create (& tmpItem ); result .Error != nil {
282293 return result .Error
283294 }
Original file line number Diff line number Diff line change 1+ // Copyright 2025 Blink Labs Software
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ package models
16+
17+ type Account struct {
18+ ID uint `gorm:"primarykey"`
19+ StakingKey []byte `gorm:"index,unique"`
20+ DepositAmount uint64
21+ AddedSlot uint64
22+ Pool []byte `gorm:"index"`
23+ Drep []byte `gorm:"index"`
24+ }
25+
26+ func (a * Account ) TableName () string {
27+ return "account"
28+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ package models
1616
1717// MigrateModels contains a list of model objects that should have DB migrations applied
1818var MigrateModels = []any {
19+ & Account {},
1920 & AuthCommitteeHot {},
2021 & Deregistration {},
2122 & Drep {},
You can’t perform that action at this time.
0 commit comments