[#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
|
||||
}
|
||||
|
||||
txTable := common.NewTransferTable()
|
||||
|
||||
for i := range cnrEstimations {
|
||||
owner, err := inc.container.ContainerInfo(cnrEstimations[i].ContainerID)
|
||||
if err != nil {
|
||||
|
@ -61,14 +63,14 @@ func (inc *IncomeSettlementContext) Collect() {
|
|||
inc.distributeTable.Put(cnrNodes[i].PublicKey(), avg)
|
||||
}
|
||||
|
||||
inc.txTable.Transfer(&common.TransferTx{
|
||||
txTable.Transfer(&common.TransferTx{
|
||||
From: owner.Owner(),
|
||||
To: inc.bankOwner,
|
||||
Amount: total,
|
||||
})
|
||||
}
|
||||
|
||||
common.TransferAssets(inc.exchange, inc.txTable)
|
||||
common.TransferAssets(inc.exchange, txTable)
|
||||
}
|
||||
|
||||
// avgEstimation returns estimation value for single container. Right now it
|
||||
|
|
|
@ -41,7 +41,6 @@ type (
|
|||
exchange common.Exchanger
|
||||
accounts common.AccountStorage
|
||||
|
||||
txTable *common.TransferTable
|
||||
bankOwner *owner.ID
|
||||
|
||||
// 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,
|
||||
exchange: p.Exchange,
|
||||
accounts: p.Accounts,
|
||||
txTable: common.NewTransferTable(),
|
||||
bankOwner: bankingAccount,
|
||||
distributeTable: NewNodeSizeTable(),
|
||||
}, nil
|
||||
|
|
Loading…
Reference in a new issue