forked from TrueCloudLab/frostfs-node
[#365] settlement/basic: Remove TxTable from context
TxTable used twice in context to transfer assets to and from banking account. There is no need to store instance of table persistently. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
fd461bdb65
commit
6a9a2b5d04
2 changed files with 4 additions and 4 deletions
|
@ -34,6 +34,8 @@ func (inc *IncomeSettlementContext) Collect() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txTable := common.NewTransferTable()
|
||||||
|
|
||||||
for i := range cnrEstimations {
|
for i := range cnrEstimations {
|
||||||
owner, err := inc.container.ContainerInfo(cnrEstimations[i].ContainerID)
|
owner, err := inc.container.ContainerInfo(cnrEstimations[i].ContainerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -61,14 +63,14 @@ func (inc *IncomeSettlementContext) Collect() {
|
||||||
inc.distributeTable.Put(cnrNodes[i].PublicKey(), avg)
|
inc.distributeTable.Put(cnrNodes[i].PublicKey(), avg)
|
||||||
}
|
}
|
||||||
|
|
||||||
inc.txTable.Transfer(&common.TransferTx{
|
txTable.Transfer(&common.TransferTx{
|
||||||
From: owner.Owner(),
|
From: owner.Owner(),
|
||||||
To: inc.bankOwner,
|
To: inc.bankOwner,
|
||||||
Amount: total,
|
Amount: total,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
common.TransferAssets(inc.exchange, inc.txTable)
|
common.TransferAssets(inc.exchange, txTable)
|
||||||
}
|
}
|
||||||
|
|
||||||
// avgEstimation returns estimation value for single container. Right now it
|
// avgEstimation returns estimation value for single container. Right now it
|
||||||
|
|
|
@ -41,7 +41,6 @@ type (
|
||||||
exchange common.Exchanger
|
exchange common.Exchanger
|
||||||
accounts common.AccountStorage
|
accounts common.AccountStorage
|
||||||
|
|
||||||
txTable *common.TransferTable
|
|
||||||
bankOwner *owner.ID
|
bankOwner *owner.ID
|
||||||
|
|
||||||
// this table is not thread safe, make sure you use it with mu.Lock()
|
// this table is not thread safe, make sure you use it with mu.Lock()
|
||||||
|
@ -77,7 +76,6 @@ func NewIncomeSettlementContext(p *IncomeSettlementContextPrms) (*IncomeSettleme
|
||||||
placement: p.Placement,
|
placement: p.Placement,
|
||||||
exchange: p.Exchange,
|
exchange: p.Exchange,
|
||||||
accounts: p.Accounts,
|
accounts: p.Accounts,
|
||||||
txTable: common.NewTransferTable(),
|
|
||||||
bankOwner: bankingAccount,
|
bankOwner: bankingAccount,
|
||||||
distributeTable: NewNodeSizeTable(),
|
distributeTable: NewNodeSizeTable(),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
Loading…
Reference in a new issue