Skip to content

Commit

Permalink
Feat/4.14.1 (#139)
Browse files Browse the repository at this point in the history
* 4.14.1

* 4.14.1
  • Loading branch information
dev-ptera authored Mar 21, 2024
1 parent 8db96d8 commit 41f4bc4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## v4.14.1 (March 20, 2024)

### Fixed

- Adds a check when receiving transactions, enforce that balance increases.

## v4.14.0 (March 16, 2024)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thebananostand",
"version": "4.14.0",
"version": "4.14.1",
"scripts": {
"ng": "ng",
"start": "ng serve --open --host 0.0.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/app/services/rpc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class RpcService {
}

/** Returns array of receivable transactions, sorted by balance descending. */
// TODO: Use this instead of Spyglass API receivable call.
async getReceivable(address: string): Promise<ReceivableHash[]> {
const MAX_PENDING = 100;
const threshold = this._util.convertBanToRaw(this._appStateService.store.getValue().minimumBananoThreshold);
Expand Down
11 changes: 10 additions & 1 deletion src/app/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PowService } from '@app/services/pow.service';
import { AccountOverview } from '@app/types/AccountOverview';
import { TransactionBlock } from '@app/types/TransactionBlock';
import { ReceivableTx } from '@app/types/ReceivableTx';
import { UtilService } from '@app/services/util.service';

type BananoifiedWindow = {
bananocoinBananojs: any;
Expand Down Expand Up @@ -57,7 +58,8 @@ export class TransactionService {
private readonly _signerService: SignerService,
private readonly _datasource: DatasourceService,
private readonly _appStateService: AppStateService,
private readonly _rpcService: RpcService
private readonly _rpcService: RpcService,
private readonly _util: UtilService
) {}

private async _configApi(bananodeApi): Promise<void> {
Expand Down Expand Up @@ -178,6 +180,13 @@ export class TransactionService {
const valueRaw = (BigInt(incoming.amountRaw) + BigInt(accountBalanceRaw)).toString();
const isOpeningAccount = !accountInfo.representative;

const beforeTxBan = this._util.convertRawToBan(accountBalanceRaw);
const afterTxBan = this._util.convertRawToBan(valueRaw);
if (afterTxBan < beforeTxBan) {
console.error('Receivable block lowers account balance, rejecting block.', beforeTxBan, afterTxBan);
return undefined;
}

// TODO - Get this from the rep list, top rep please.
const representative = isOpeningAccount
? 'ban_3batmanuenphd7osrez9c45b3uqw9d9u81ne8xa6m43e1py56y9p48ap69zg'
Expand Down

0 comments on commit 41f4bc4

Please sign in to comment.